public static bool SetCurrentContextDetails(LoggingContextDetails contextDetails) { string currContextId = GetCurrentContextId(); if (currContextId == null) { return(false); } AddContext(currContextId, contextDetails, true); return(true); }
private void SetLoggingContext(object[] inputs, MethodInfo mi) { LoggingContextDetails lcd = new LoggingContextDetails { MethodDetails = mi, Inputs = inputs, LoggingStrategy = LoggingStrategy, LogErrors = LogErrors, LogWarnings = LogWarnings, LogInformation = LogInformation }; LoggingContext.SetCurrentContextDetails(lcd); }
protected static void AddContext(string id, LoggingContextDetails contextDetails, bool replaceIfExist) { if (id == null) { return; } lock (Contexts) { if (replaceIfExist && Contexts.ContainsKey(id)) { Contexts.Remove(id); } if (!Contexts.ContainsKey(id) && contextDetails != null) { Contexts.Add(id, contextDetails); } } }