예제 #1
0
        private static void OnLog(
            LogMessage logMessage,
            KafkaConsumer consumer,
            ISilverbackLogger logger)
        {
            switch (logMessage.Level)
            {
            case SyslogLevel.Emergency:
            case SyslogLevel.Alert:
            case SyslogLevel.Critical:
                logger.LogConfluentConsumerLogCritical(logMessage, consumer);
                break;

            case SyslogLevel.Error:
                logger.LogConfluentConsumerLogError(logMessage, consumer);
                break;

            case SyslogLevel.Warning:
                logger.LogConfluentConsumerLogWarning(logMessage, consumer);
                break;

            case SyslogLevel.Notice:
            case SyslogLevel.Info:
                logger.LogConfluentConsumerLogInformation(logMessage, consumer);
                break;

            default:
                logger.LogConfluentConsumerLogDebug(logMessage, consumer);
                break;
            }
        }
예제 #2
0
        private static void OnLog(
            LogMessage logMessage,
            KafkaConsumer consumer,
            IBrokerCallbacksInvoker callbacksInvoker,
            ISilverbackLogger logger)
        {
            try
            {
                bool handled = false;

                callbacksInvoker.Invoke <IKafkaConsumerLogCallback>(
                    handler =>
                {
                    handled &= handler.OnConsumerLog(logMessage, consumer);
                });

                if (handled)
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                logger.LogKafkaLogHandlerError(consumer, ex);
            }

            switch (logMessage.Level)
            {
            case SyslogLevel.Emergency:
            case SyslogLevel.Alert:
            case SyslogLevel.Critical:
                logger.LogConfluentConsumerLogCritical(logMessage, consumer);
                break;

            case SyslogLevel.Error:
                logger.LogConfluentConsumerLogError(logMessage, consumer);
                break;

            case SyslogLevel.Warning:
                logger.LogConfluentConsumerLogWarning(logMessage, consumer);
                break;

            case SyslogLevel.Notice:
            case SyslogLevel.Info:
                logger.LogConfluentConsumerLogInformation(logMessage, consumer);
                break;

            default:
                logger.LogConfluentConsumerLogDebug(logMessage, consumer);
                break;
            }
        }