private static void OnLog( LogMessage logMessage, KafkaProducer producer, ISilverbackLogger logger) { switch (logMessage.Level) { case SyslogLevel.Emergency: case SyslogLevel.Alert: case SyslogLevel.Critical: logger.LogConfluentProducerLogCritical(logMessage, producer); break; case SyslogLevel.Error: logger.LogConfluentProducerLogError(logMessage, producer); break; case SyslogLevel.Warning: logger.LogConfluentProducerLogWarning(logMessage, producer); break; case SyslogLevel.Notice: case SyslogLevel.Info: logger.LogConfluentProducerLogInformation(logMessage, producer); break; default: logger.LogConfluentProducerLogDebug(logMessage, producer); break; } }
private static void OnLog( LogMessage logMessage, KafkaProducer producer, IBrokerCallbacksInvoker callbacksInvoker, ISilverbackLogger logger) { try { bool handled = false; callbacksInvoker.Invoke <IKafkaProducerLogCallback>( handler => { handled &= handler.OnProducerLog(logMessage, producer); }); if (handled) { return; } } catch (Exception ex) { logger.LogKafkaLogHandlerError(producer, ex); } switch (logMessage.Level) { case SyslogLevel.Emergency: case SyslogLevel.Alert: case SyslogLevel.Critical: logger.LogConfluentProducerLogCritical(logMessage, producer); break; case SyslogLevel.Error: logger.LogConfluentProducerLogError(logMessage, producer); break; case SyslogLevel.Warning: logger.LogConfluentProducerLogWarning(logMessage, producer); break; case SyslogLevel.Notice: case SyslogLevel.Info: logger.LogConfluentProducerLogInformation(logMessage, producer); break; default: logger.LogConfluentProducerLogDebug(logMessage, producer); break; } }