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); } }); }
private Event Event(Call call, EventType type) { return(new Event() { Type = type, Timestamp = TimestampFormatter.RoundTimestampToSeconds(DateTime.Now), Call = call }); }
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)) })); }
void Awake() { _socket = new SocketAppender(); _defaultFormatter = new DefaultLogMessageFormatter(); _timestampFormatter = new TimestampFormatter(); _colorFormatter = new ColorCodeFormatter(); if (cacheLogsWhenNotConnected) { LoggerFactory.AddAppender(send); } }
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); }); }
public override String ToString() => $"{TimestampFormatter.Format(this.FirstSeenTicks)} > {this.Direction.ToString()} > {this.PayloadLen} B";
void Awake() { _fileWriter = new FileWriter(filePath); _defaultFormatter = new DefaultLogMessageFormatter(); _timestampFormatter = new TimestampFormatter(); }
public override String ToString() => $"{TimestampFormatter.Format(this.FirstSeen)} > {this.ProtocolType} {this.SourceEndPoint}-{this.DestinationEndPoint} > UpPDUs:{this._upPdus.Count} DownPDUs:{this._downPdus.Count}";