public void Write(LogInfo info) { if (!AllowedLogLevels.Contains(info.Level)) { return; } WriteWhenAllowed(info); }
/// <summary> /// Log a Warning message /// </summary> /// <param name="type">the module(class) type</param> /// <param name="message">the message to log (optional)</param> /// <param name="correlationId">User supplied correlation id</param> /// <param name="extendedProperites">Custom key-value pair enumeration</param> /// <param name="elaspedTime">the elasped time for the LogEntry (optional)</param> /// <param name="ex">The exception to include in the LogEntry (optional)</param> /// <param name="filepath">The filepath where the log originates (supplied by system)</param> /// <param name="caller">The calling method (supplied by system)</param> /// <param name="lineNo">The line number where the Log originates (supplied by system)/param> public void LogWarning(Type type, string message = "", string correlationId = "", IDictionary <string, object> extendedProperties = null, TimeSpan?elaspedTime = null, Exception ex = null, [CallerFilePath] string filepath = "", [CallerMemberName] string caller = "", [CallerLineNumber] int lineNo = 0) { if (!AllowedLogLevels.HasFlag(LogLevels.Warning)) { return; } var logEntry = CreateLogEntry(LogLevels.Warning, type, message, correlationId, extendedProperties, elaspedTime, ex, filepath, caller, lineNo); AddItem(logEntry); }