internal LogEvent(LogEvent sourceLogEvent, long endTimeStamp) { TimeStamp = endTimeStamp; ScopeTime = endTimeStamp - sourceLogEvent.TimeStamp; Logger = sourceLogEvent.Logger; MemberName = sourceLogEvent.MemberName; FileName = sourceLogEvent.FileName; LineNumber = sourceLogEvent.LineNumber; LogLevel = sourceLogEvent.LogLevel; AppName = sourceLogEvent.AppName; Message = sourceLogEvent.Message; }
protected override void WriteLine(string textLine, LogEvent logEvent) { lock (this) { _streamWriter.WriteLine(textLine); // var count = Interlocked.Increment(ref _writeLineCallCount); // if (count%_lineCountPerFlush == 0) // { _streamWriter.Flush(); // } } }
internal void Log(LogEvent logEvent) { lock(_logWritersPerLogger) { List<LogWriter> logWriters; if (!_logWritersPerLogger.TryGetValue(logEvent.Logger, out logWriters)) { throw new NullReferenceException("Logger is missing from LogManager."); } foreach (var logWriter in logWriters) { logWriter.Log(logEvent); } } }
public void Dispose() { var logEvent = new LogEvent(_logEvent, Logger.Stopwatch.ElapsedMilliseconds); _logger.Log(logEvent); }
internal LoggerScope(Logger logger, LogEvent logEvent) { _logger = logger; _logEvent = logEvent; }
protected override void WriteLine(string textLine, LogEvent logEvent) { Console.WriteLine(textLine); }
formatString, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ); _logManager.Log(logEvent); } public void Debug ( string formatString, object arg0 = null, object arg1 = null, object arg2 = null, object arg3 = null, object arg4 = null, object arg5 = null, object arg6 = null, object arg7 = null, object arg8 = null, object arg9 = null, string overflowGuard = UniqueString, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0 ) { if (overflowGuard != UniqueString) throw new OverflowException("Only 10 arguments are supported"); var logLevel = LogLevel.Debug; if (_minimumLogLevel.Ordinal > logLevel.Ordinal) return; var logEvent = new LogEvent ( Stopwatch.ElapsedMilliseconds, this, _loggingType, memberName, sourceFilePath, sourceLineNumber, logLevel,
arg0, arg1, arg2, arg3, arg4, arg5, arg6,
protected abstract void WriteLine(string textLine, LogEvent logEvent);
internal void Log(LogEvent logEvent) { if (GetLogLevel(logEvent.Logger).Ordinal <= logEvent.LogLevel.Ordinal) { WriteLine(_logFormatter(logEvent), logEvent); } }