Example #1
0
        private void SetupLogger()
        {
            var defaultFormatter   = new DefaultLogMessageFormatter();
            var timestampFormatter = new TimestampFormatter();

            LoggerFactory.AddAppender((logger, logLevel, message) => {
                message = defaultFormatter.FormatMessage(logger, logLevel, message);
                message = timestampFormatter.FormatMessage(logger, logLevel, message);
                switch (logLevel)
                {
                case LogLevel.On:
                case LogLevel.Trace:
                case LogLevel.Debug:
                case LogLevel.Info:
                    Debug.Log(message);
                    break;

                case LogLevel.Warn:
                    Debug.LogWarning(message);
                    break;

                case LogLevel.Error:
                case LogLevel.Fatal:
                    Debug.LogError(message);
                    break;

                case LogLevel.Off:
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(logLevel), logLevel, null);
                }
            });
        }
Example #2
0
 private Event Event(Call call, EventType type)
 {
     return(new Event()
     {
         Type = type,
         Timestamp = TimestampFormatter.RoundTimestampToSeconds(DateTime.Now),
         Call = call
     });
 }
Example #3
0
        private static ILogger CreateLogger()
        {
            var logFormatter = new TimestampFormatter();

            return(new MultiLogger(new ILogger[]
            {
                new ConsoleLogger(logFormatter, LogSensitivity.InformationHigh),
                new HTMLLogger(logFormatter,
                               string.Format("{0:yyyy-MM-dd HHmm}.html", DateTime.Now))
            }));
        }
Example #4
0
        void Awake()
        {
            _socket             = new SocketAppender();
            _defaultFormatter   = new DefaultLogMessageFormatter();
            _timestampFormatter = new TimestampFormatter();
            _colorFormatter     = new ColorCodeFormatter();

            if (cacheLogsWhenNotConnected)
            {
                LoggerFactory.AddAppender(send);
            }
        }
Example #5
0
        static void consoleLogTest()
        {
            var defaultFormatter   = new DefaultLogMessageFormatter();
            var timestampFormatter = new TimestampFormatter();
            var colorFormatter     = new ColorCodeFormatter();

            LoggerFactory.AddAppender((logger, logLevel, message) => {
                message = defaultFormatter.FormatMessage(logger, logLevel, message);
                message = timestampFormatter.FormatMessage(logger, logLevel, message);
                message = colorFormatter.FormatMessage(logLevel, message);
                Console.WriteLine(message);
            });
        }
Example #6
0
 public override String ToString() => $"{TimestampFormatter.Format(this.FirstSeenTicks)} > {this.Direction.ToString()} > {this.PayloadLen} B";
Example #7
0
 void Awake()
 {
     _fileWriter         = new FileWriter(filePath);
     _defaultFormatter   = new DefaultLogMessageFormatter();
     _timestampFormatter = new TimestampFormatter();
 }
Example #8
0
 public override String ToString() =>
 $"{TimestampFormatter.Format(this.FirstSeen)} > {this.ProtocolType} {this.SourceEndPoint}-{this.DestinationEndPoint} > UpPDUs:{this._upPdus.Count} DownPDUs:{this._downPdus.Count}";