示例#1
0
            public Exception OnException(ITask currentTask, TaskLog log, Vertica.Integration.Model.Arguments arguments, Exception exception)
            {
                string alias = arguments["Alias"];

                log.LogMessage($"Unable to start {alias} (TaskLogId: {log.Id}): {exception.Message}");

                // Return <null> to stop the task from being executed but without any exceptions thrown

                return(null);
            }
示例#2
0
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            if (formatter == null)
            {
                throw new ArgumentNullException(nameof(formatter));
            }

            var message = formatter(state, exception);

            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            switch (logLevel)
            {
            case LogLevel.Error:
                TaskLog?.LogError(message);
                break;

            case LogLevel.Warning:
                TaskLog?.LogWarning(message);
                break;

            case LogLevel.Information:
                TaskLog?.LogMessage(MessageImportance.Normal, message);
                break;

            case LogLevel.Debug:
                TaskLog?.LogMessage(MessageImportance.Low, message);
                break;

            default:
                TaskLog?.LogMessage(message);
                break;
            }
        }