private static void SetCustomerLogLevel(LogsForCustomer customerId, ApiLogLevel defaultLogLevel) { var logLevel = defaultLogLevel; var custLogLevel = GetCustLogeLevelsFromJson().Where(cust => cust.CustomerId == customerId).SingleOrDefault(); if (custLogLevel != null) { logLevel = custLogLevel.LogLevel; CustomLogLevels.GetLogLevel.MinimumLevel = FromApiLogLevelToLogEventLevel(logLevel); } }
private static LogLevel GetCustomerLogLevel_1(LogsForCustomer customerId, ApiLogLevel defaultLogLevel) { var logLevel = defaultLogLevel; var custLogLevel = GetCustLogeLevelsFromJson().Where(cust => cust.CustomerId == customerId).SingleOrDefault(); if (custLogLevel != null) { logLevel = custLogLevel.LogLevel; } return(FromAPILogLevelToLogLevel(logLevel)); }
public static void Emit <T>(this ILogger <T> @this, LogsForCustomer custEventId, ApiLogLevel apiLogLevel, Exception exception, string message, params object[] args) { var i = (int)Convert.ChangeType(custEventId, custEventId.GetTypeCode()); var eventName = Enum.GetName(custEventId.GetType(), custEventId); var eventScope = custEventId.GetType().Name; SetCustomerLogLevel(custEventId, apiLogLevel); var parameters = args.Append(eventScope).Append(eventName).ToArray(); var lvl = GetCustomerLogLevel_1(custEventId, apiLogLevel); @this.Log(lvl, i, exception, message + " (Event scope: {eventScope}, name: {eventName})", parameters); }