public AuditCommandHandlerDecorator( ICommandHandler <TCommand> decorated, IGlobalLogger globalLogger) { _decorated = decorated; _globalLogger = globalLogger; }
public CommandParser( IOutputFormatter templateBuilder, IRegisteredVerbs registeredVerbs, IGlobalLogger logger) { _outputFormatter = templateBuilder; _registeredVerbs = registeredVerbs; _logger = logger; }
public ServeCommandHandler( IGlobalLogger globalLogger, ILocalConfiguration localConfiguration, IWebServer webServer) { this.globalLogger = globalLogger; this.localConfiguration = localConfiguration; this.webServer = webServer; }
public ExceptionHandler( IOutputFormatter outputFormatter, ITerminal terminal, IGlobalLogger logger) { _outputFormatter = outputFormatter; _terminal = terminal; _logger = logger; }
public static string ExceptionMessage(Exception ex, string where = null, IGlobalLogger logger = null) { try { var exExtract = (logger is null ? new Func <Exception, string>(CurrentLogger.ExtractExceptionMessage) : logger.ExtractExceptionMessage); var message = exExtract(ex); return(where is null ? message : message + " in " + where); } catch { return("ExceptionMessage failed " + ex); } }
public Application( ICommandParser commandParser, ICommandProcessor commandProcessor, IGlobalLogger globalLogger, IGlobalConfiguration globalConfiguration, ITerminal terminal) { _commandParser = commandParser; _commandProcessor = commandProcessor; _globalLogger = globalLogger; _globalConfiguration = globalConfiguration; _terminal = terminal; }
public static void ExceptionCatcher(Action ignoredExceptionAction, string where = null, IGlobalLogger logger = null) { try { ignoredExceptionAction(); } catch (Exception ex) { try { var logEx = (logger is null ? new Action <string, Exception>(CurrentLogger.LogEx) : logger.LogEx); logEx(where, ex); } catch { // ignored } } }
public static TResult ExceptionCatcher <TResult>(Func <TResult> ignoredExceptionFunction, TResult defaultValue = default(TResult), string where = null, IGlobalLogger logger = null) { try { return(ignoredExceptionFunction()); } catch (Exception ex) { try { var logEx = (logger is null ? new Action <string, Exception>(CurrentLogger.LogEx) : logger.LogEx); logEx(where, ex); } catch { // ignored } } return(defaultValue); }
public void Initialise() { Logger = new ConsoleGlobalLogger(); }