Example #1
0
 /// <summary>Makes a copy of the existing LogRecord.</summary>
 public LogRecord(LogRecord logRecord)
 {
     srcLog         = logRecord.srcLog;
     _lastId        = logRecord._lastId;
     _timestamp     = logRecord.timestamp;
     mergedLogs     = logRecord.mergedLogs;
     similarityHash = logRecord.similarityHash;
 }
 /// <summary>A callback handler for incoming Unity log records.</summary>
 /// <remarks>
 /// <para>
 /// The record is only stored if it's not banned by <see cref="CheckIsFiltered"/>.
 /// </para>
 /// <para>
 /// The incoming records are buffered in a list, and get aggregated when the buffer is exhausted.
 /// Such approach saves CPU when no log console UI is presented.
 /// </para>
 /// </remarks>
 /// <param name="log">Raw log record.</param>
 void LogPreview(LogInterceptor.Log log)
 {
     if (CheckIsFiltered(log))
     {
         return;
     }
     // Override unsupported log types into INFO.
     if (log.type != LogType.Log && log.type != LogType.Warning &&
         log.type != LogType.Error && log.type != LogType.Exception)
     {
         log.type = LogType.Log;
     }
     rawLogsBuffer.Add(log);
     if (rawLogsBuffer.Count >= rawBufferSize)
     {
         FlushBufferedLogs();
     }
 }
Example #3
0
 /// <summary>A callback handler for incoming Unity log records.</summary>
 /// <remarks>
 /// <para>The record is only stored if it's not banned by <see cref="CheckIsFiltered"/>.
 /// </para>
 /// <para>The incoming records are buffered in a list, and get aggregated when the buffer is
 /// exhausted. Such apporach saves CPU when no log console UI is presented.</para>
 /// </remarks>
 /// <param name="log">Raw log record.</param>
 private void LogPreview(LogInterceptor.Log log)
 {
     if (CheckIsFiltered(log))
     {
         return;
     }
     // Override unsupported log types into INFO.
     if (log.type != LogType.Log && log.type != LogType.Warning &&
         log.type != LogType.Error && log.type != LogType.Exception)
     {
         log = new LogInterceptor.Log(
             log.id, log.timestamp, log.message, log.stackTrace, log.source, LogType.Log);
     }
     rawLogsBuffer.Add(log);
     if (rawLogsBuffer.Count >= rawBufferSize)
     {
         FlushBufferedLogs();
     }
 }
 /// <inheritdoc/>
 protected override bool CheckIsFiltered(LogInterceptor.Log log)
 {
     return(false); // Persist any log!
 }
Example #5
0
 /// <summary>A generic wrapper for Unity log records.</summary>
 /// <param name="log">A Unity log record.</param>
 public LogRecord(LogInterceptor.Log log)
 {
     srcLog     = log;
     _lastId    = log.id;
     _timestamp = log.timestamp;
 }
Example #6
0
 /// <summary>Verifies if <paramref name="log"/> matches the filters.</summary>
 /// <param name="log">A log record to check.</param>
 /// <returns><c>true</c> if any of the filters matched.</returns>
 protected virtual bool CheckIsFiltered(LogInterceptor.Log log)
 {
     return(LogFilter.CheckLogForFilter(log));
 }
Example #7
0
 /// <summary>Verifies if <paramref name="log"/> macthes the filters.</summary>
 /// <param name="log">A log record to check.</param>
 /// <returns><c>true</c> if any of the filters matched.</returns>
 public static bool CheckLogForFilter(LogInterceptor.Log log)
 {
     return(exactFilter.Contains(log.source) || prefixFilter.Any(log.source.StartsWith));
 }