コード例 #1
0
 public QuickLoggerService(ILoggerSettingsPathFinder loggerSettingsPathFinder, IAdditionalLoggerInfoProviderService additionalInfoProvider = null) : this()
 {
     _loggerSettingsPathFinder     = loggerSettingsPathFinder;
     _additionalLoggerInfoProvider = additionalInfoProvider;
     _settings = LoadConfigFromDisk();
     foreach (var provider in _settings.Providers())
     {
         try
         {
             var providername = String.Format("[Name : {0}] - [PID : {1}] - [GUID : {2}]", provider.getProviderProperties().GetProviderName(),
                                              System.Diagnostics.Process.GetCurrentProcess().Id, Guid.NewGuid().ToString());
             provider.getProviderProperties().SetProviderName(providername);
             _quicklogger?.AddProvider(provider);
         }
         catch (Exception ex)
         {
             //TODO : Turrican -> Do something with this! Case provider cannot be added...
         }
     }
     InitMessage();
 }
コード例 #2
0
        public void Add_Logger_Default_Console_Provider_To_New_Logger()
        {
            ILoggerProviderProps providerProps = new QuickLoggerProviderProps("Test Console Provider First test", "ConsoleProvider");

            providerProps.SetProviderInfo(_consoleProviderInfo);
            ILoggerProvider loggerProvider = new QuickLoggerProvider(providerProps);

            LoggerCallbackHandler(loggerProvider);
            _logger.AddProvider(loggerProvider);
            _logger.Info("Works");
            _logger.Custom("Works");
            _logger.Error("Works");
            _logger.Success("Works");
            //Assert that words are shown on the console
            _logger.DisableProvider(loggerProvider);
            _logger.RemoveProvider(loggerProvider);
        }