public AuditCommandHandlerDecorator(
     ICommandHandler <TCommand> decorated,
     IGlobalLogger globalLogger)
 {
     _decorated    = decorated;
     _globalLogger = globalLogger;
 }
Ejemplo n.º 2
0
 public CommandParser(
     IOutputFormatter templateBuilder,
     IRegisteredVerbs registeredVerbs,
     IGlobalLogger logger)
 {
     _outputFormatter = templateBuilder;
     _registeredVerbs = registeredVerbs;
     _logger          = logger;
 }
Ejemplo n.º 3
0
 public ServeCommandHandler(
     IGlobalLogger globalLogger,
     ILocalConfiguration localConfiguration,
     IWebServer webServer)
 {
     this.globalLogger       = globalLogger;
     this.localConfiguration = localConfiguration;
     this.webServer          = webServer;
 }
Ejemplo n.º 4
0
 public ExceptionHandler(
     IOutputFormatter outputFormatter,
     ITerminal terminal,
     IGlobalLogger logger)
 {
     _outputFormatter = outputFormatter;
     _terminal        = terminal;
     _logger          = logger;
 }
Ejemplo n.º 5
0
 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);
     }
 }
Ejemplo n.º 6
0
 public Application(
     ICommandParser commandParser,
     ICommandProcessor commandProcessor,
     IGlobalLogger globalLogger,
     IGlobalConfiguration globalConfiguration,
     ITerminal terminal)
 {
     _commandParser       = commandParser;
     _commandProcessor    = commandProcessor;
     _globalLogger        = globalLogger;
     _globalConfiguration = globalConfiguration;
     _terminal            = terminal;
 }
Ejemplo n.º 7
0
 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
         }
     }
 }
Ejemplo n.º 8
0
 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);
 }
Ejemplo n.º 9
0
 public void Initialise()
 {
     Logger = new ConsoleGlobalLogger();
 }