private static void OnSolaceEvent(SolLogInfo info, ILogger <ContextFactory> logger) { switch (info.LogLevel) { case SolLogLevel.Emergency: case SolLogLevel.Alert: case SolLogLevel.Critical: case SolLogLevel.Error: if (info.LogException == null) { logger.LogError("{0}: {1}", info.LoggerName, info.LogMessage); } else { logger.LogError(info.LogException, "{0}: {1}", info.LoggerName, info.LogMessage); } break; case SolLogLevel.Warning: if (info.LogException == null) { logger.LogWarning("{0}: {1}", info.LoggerName, info.LogMessage); } else { logger.LogWarning(info.LogException, "{0}: {1}", info.LoggerName, info.LogMessage); } break; } }
/// <summary> /// Log delegate for redirecting Solace .NET API logs to the wrapper's /// logging abstraction. /// </summary> /// <param name="solLogInfo">The Solace API log info containing the level, /// exception, and message.</param> private void OnSolaceApiLog(SolLogInfo solLogInfo) { var logLevel = GetLogLevel(solLogInfo.LogLevel); if (logger.IsEnabled(logLevel)) { logger.Log(logLevel, solLogInfo.LogException, solLogInfo.LogMessage); } }
/// Prints an API log event to the error console. /// </summary> /// <param name="logInfo"></param> internal void LogItToErrorConsole(SolLogInfo logInfo) { Console.Error.WriteLine("- Redirected Log: " + logInfo.ToString()); }