Create nice summary logs.

        @param log: log to create summary off of.
433528
def createSummary(self, log):
        
        warnings = self.obs.warnings
        errors = []
        if warnings:
            self.addCompleteLog('%d Warnings' % len(warnings), "\n".join(warnings))
        if errors:
            self.addCompleteLog('%d Errors' % len(errors), "\n".join(errors))
267101
function Logger_log(message, data, type) {

            if (!this.config.enabled) {
                return;
            }

            if (this.config.types.indexOf(type) === -1) {
                type = 'ALL';
            }

            this.logs.push({
                type: type,
                message: message,
                trace: this.trace(),
                data: this.inspect(data),
                created: new Date().toISOString()
            });

            process.nextTick(this.write.bind(this));
        }
1066890
def setupLogFile(self):
		""""""
		self.logWrite("\n###############################################")
		self.logWrite("calcpkg.py log from " + str(datetime.datetime.now()))
		self.changeLogging(True)
47502
public void log(Log log) {
    log.info("Counters: " + size());
    for(Group group: this) {
      log.info("  " + group.getDisplayName());
      for (Counter counter: group) {
        log.info("    " + counter.getDisplayName() + "=" + 
                 counter.getCounter());
      }   
    }
  }
1314833
def _log(self, message, severity=Logger.DEBUG):
        
        return self.logger.log(message, severity, self.TAG)
1271091
private void doLog(long lastRun, long finalMoment)
    {
        double[] percentilenames = m_percentiles;

        //
        //  Do logging, if requested.
        //
        if( m_mode == Mode.LOG_ONLY || m_mode == Mode.ALL )
        {
            if( m_log != null && m_log.isInfoEnabled() )
            {
                StringBuilder percString = new StringBuilder();
                for( int i = 0; i < percentilenames.length; i++ )
                {
                    percString.append( String.format( " %6sth", saneDoubleToString(percentilenames[i]) ) );
                }
                
                printf("Statistics from %tc to %tc", new Date(lastRun), new Date(finalMoment));

                printf("%-"+m_tagWidth+"s %8s %8s %8s %8s%s%8s","Tag","Avg(ms)","Min","Max","Std Dev",percString,"Count");

                for( Map.Entry<String,CollectedStatistics> e : m_stats.entrySet() )
                {
                    CollectedStatistics cs = e.getValue();
                    StringBuilder sb = new StringBuilder();
                    
                    sb.append(String.format("%-"+m_tagWidth+"s %8.2f %8.2f %8.2f %8.2f", e.getKey(),cs.getAverageMS(), cs.getMin(), cs.getMax(), cs.getStdDev()));
                    for( int i = 0; i < percentilenames.length; i++ )
                        sb.append( String.format(" %8.2f", cs.getPercentile( percentilenames[i] )) );
                    
                    sb.append( String.format("%8d", cs.getInvocations()) );
                    m_log.info( sb.toString() );
                    
                    //
                    //  Only collect threshold information when the slow logging
                    //  is on.  Otherwise the array grows without bounds.
                    //
                    if( m_slowLogOn && m_slowLog != null )
                    {
                        long threshold = (long)(cs.getPercentile(m_slowLogPercentile)*1000);
                        m_slowThresholdMicros.put( e.getKey(), threshold );
                    }
                }
                
                m_log.info( "" );
            }
        }

        //
        //  Store these to the JMX attribute list
        //

        if( m_mode == Mode.JMX_ONLY || m_mode == Mode.ALL )
        {
            if( m_jmxAttributes != null )
            {
                m_jmxStatistics = new ConcurrentHashMap<String, PeriodicalLog.JmxStatistics>();

                for( String name : m_jmxAttributes )
                {
                    String n = name.trim();
                    CollectedStatistics cs = m_stats.get(n);

                    if ( cs == null )
                        continue;

                    JmxStatistics js = new JmxStatistics();
                    js.count = cs.getInvocations();
                    js.max = cs.getMax();
                    js.min = cs.getMin();
                    js.mean = cs.getAverageMS();
                    js.percentiles = new double[percentilenames.length];
                    
                    for( int i = 0; i < percentilenames.length; i++ )
                        js.percentiles[i] = cs.getPercentile( percentilenames[i] );
                    
                    js.stddev = cs.getStdDev();
                    m_jmxStatistics.put(n, js);
                }
            }
        }

        resetForNextPeriod();
    }
23671
private function writeLogs(): void
    {
        // Write logs
        $fileName = $this->getApp()->getConfig()->getDirectory(ConfigInterface::DIR_VAR_LOGS) . '/Berlioz.log';

        if (is_resource($this->fp) || is_resource($this->fp = @fopen($fileName, 'a'))) {
            if (count($this->logs) > 0) {
                foreach ($this->logs as $key => $log) {
                    if (!$log['written']) {
                        $line = sprintf("%-26s %-11s %s\n",
                                        \DateTime::createFromFormat('U.u', number_format($log['time'], 6, '.', ''))
                                                 ->format('Y-m-d H:i:s.u'),
                                        '[' . $log['level'] . ']',
                                        $log['message']);

                        if (@fwrite($this->fp, $line) !== false) {
                            $this->logs[$key]['written'] = true;
                        }
                    }
                }
            }
            unset($log);
        }
    }
365989
public void appendToLog(String logAppendMessage) {
		ProfilingTimerNode currentNode = current.get();
		if (currentNode != null) {
			currentNode.appendToLog(logAppendMessage);
		}
	}
561025
def log_create(sender, instance, created, **kwargs):
    
    if created:
        changes = model_instance_diff(None, instance)

        log_entry = LogEntry.objects.log_create(
            instance,
            action=LogEntry.Action.CREATE,
            changes=json.dumps(changes),
        )
972191
def _log_request(self, request):
        
        msg = []
        for d in self.LOG_DATA:
            val = getattr(request, d)
            if val:
                msg.append(d + ': ' + repr(val))
        for d in self.LOG_HEADERS:
            if d in request.headers and request.headers[d]:
                msg.append(d + ': ' + repr(request.headers[d]))
        logger.info("Request information: %s", ', '.join(msg))
1031525
def _create_stdout_logger(logging_level):
    
    out_hdlr = logging.StreamHandler(sys.stdout)
    out_hdlr.setFormatter(logging.Formatter(
        '[%(asctime)s] %(message)s', "%H:%M:%S"
    ))
    out_hdlr.setLevel(logging_level)
    for name in LOGGING_NAMES:
        log = logging.getLogger(name)
        log.addHandler(out_hdlr)
        log.setLevel(logging_level)
1183877
def write_log(self, message):
        
        if self._is_write_log and self.log_file and not self.log_file.closed:
            self.log_file.write(message + '\n')
1033827
def log(self, level, *args, **kwargs):
        """"""
        return self._log_kw(level, args, kwargs)
1169278
def log_writer():
    ''''''
    while True:
        mpstate.logfile_raw.write(bytearray(mpstate.logqueue_raw.get()))
        timeout = time.time() + 10
        while not mpstate.logqueue_raw.empty() and time.time() < timeout:
            mpstate.logfile_raw.write(mpstate.logqueue_raw.get())
        while not mpstate.logqueue.empty() and time.time() < timeout:
            mpstate.logfile.write(mpstate.logqueue.get())
        if mpstate.settings.flushlogs or time.time() >= timeout:
            mpstate.logfile.flush()
            mpstate.logfile_raw.flush()
1351766
private void buildLog() throws JSONException {
        logs = new JSONObject();
        List<String> list = Log.getReportedEntries();
        if (list != null) {
            logs.put("numberOfEntry", list.size());
            JSONArray array = new JSONArray();
            for (String s : list) {
                array.put(s);
            }
            logs.put("log", array);
        }
    }
855130
@javax.annotation.Nonnull
  public String summarize(@javax.annotation.Nonnull String logSrc, final int maxLog) {
    if (logSrc.length() > maxLog * 2) {
      @javax.annotation.Nonnull final String prefix = logSrc.substring(0, maxLog);
      logSrc = prefix + String.format(
        (prefix.endsWith("\n") ? "" : "\n") + "~```\n~..." + file(logSrc, "skipping %s bytes") + "...\n~```\n",
        logSrc.length() - 2 * maxLog) + logSrc.substring(logSrc.length() - maxLog);
    }
    return logSrc;
  }
826474
def _write_to_log(self, s, truncate=False):
        """"""
        # if truncate is True, set write mode to truncate
        with open(self._logfile, 'w' if truncate else 'a') as fp:
            fp.writelines((to_text(s) if six.PY2 else to_text(s), ))