public static Logger MakeLogger(LoggerOption option) { #if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 CompositeLogger logger = new CompositeLogger(); if (option.isPrintEnabled) { logger.Add(new UnityConsoleLogger()); } if (option.isWriteEnabled) { logger.Add(new UnityFileLogger(option)); } return(logger); #else CompositeLogger logger = new CompositeLogger(); if (option.isPrintEnabled) { logger.Add(new DefaultConsoleLogger()); } if (option.isWriteEnabled) { logger.Add(new DefaultFileLogger()); } return(logger); #endif }
public MainWindowViewModel(IEventAggregator eventAggregator) { eventAggregator.Subscribe(this); _logger = new CompositeLogger(); _logger.Add(this); _logger.Add(new TextLogger()); _archiver = new FileArchiver(eventAggregator); _watcher = new FileSystemWatcher(); _watcher.Created += Archive; }
private static LoggerBase CreateLogger(string channel, LogLevel level) { if (_uiContext == null) { throw new NullReferenceException("OpenGLLoggerManager must be first configured with proper UI SynchronizationContext object!"); } var composite = new CompositeLogger(channel, level); composite.Add(new TizenLogger(channel, level)); composite.Add(new OpenGlLogger(channel, level, _uiContext)); return(composite); }
/// <summary> /// Creates the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns>Logger to use (or <see cref="NullLogger.Instance" /> if none is found)</returns> /// <exception cref="System.ArgumentNullException">type</exception> public ILogger GetLogger(Type type) { if (type == null) { throw new ArgumentNullException("type"); } ILogger resultLogger = null; CompositeLogger compositeLogger = null; foreach (var logger in _loggers) { if (!logger.Item1.IsSatisfiedBy(type)) { continue; } if (resultLogger != null) { if (compositeLogger == null) { compositeLogger = new CompositeLogger(type); compositeLogger.Add(resultLogger); } compositeLogger.Add(logger.Item2); } else { resultLogger = logger.Item2; } } return(compositeLogger ?? resultLogger ?? NullLogger.Instance); }
public StubIdeScope(ITestOutputHelper testOutputHelper) { MonitoringService = new Mock <IMonitoringService>().Object; CompositeLogger.Add(new DeveroomXUnitLogger(testOutputHelper)); CompositeLogger.Add(StubLogger); Actions = new StubIdeActions(this); VsxStubObjects.Initialize(); }
private static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("First parameter should be url address of the stream stats"); return; } var url = args[0]; var logger = new CompositeLogger(); logger.Add(new ConsoleLogger()); logger.Add(new TextFileLogger()); new SimpleReceiver(url, Interval, logger).Start(); Console.ReadKey(); }
public MainWindowViewModel(IEventAggregator eventAggregator, IConfigService configService) { eventAggregator.Subscribe(this); var logger = new CompositeLogger(); logger.Add(new TextFileLogger()); logger.Add(new EventBasedLogger(eventAggregator)); _dataReceiver = new SimpleReceiver(StatsUrl, TimeInterval, logger); // Get config _configService = configService; StatsUrl = (string)_configService.Get("StatsUrl"); TimeInterval = (int)_configService.Get("TimeInterval"); MonitorWithAppStart = (bool)_configService.Get("MonitorWithAppStart"); if (MonitorWithAppStart) { Monitor(); } }
static int Main(string[] args) { var logger = new CompositeLogger(); var fileLog = new FileLogger("GZipTest.log"); logger.AddChild(fileLog); logger.AddChild(new ConsoleLogger()); try { var argsParser = new ArgsParser(logger); var param = argsParser.ParsParams(args); if (param == null) { return(1); } _sourceFileNameProvider = new FileNameProviderStub(param.SourceFileName); _targetFileNameProvider = new FileNameProviderStub(param.TargetFileName); var systemInfoProvider = new SystemInfoProvider(); var appl = new Appl(logger, systemInfoProvider); switch (param.ApplMode) { case ApplMode.Compress: var compressStrategy = new SmartCompressStrategy(systemInfoProvider); appl.ExecuteCompress(compressStrategy, _sourceFileNameProvider, _targetFileNameProvider); break; case ApplMode.Decompress: var decompressStrategy = new SmartDecompressStrategy(systemInfoProvider); appl.ExecuteDecompress(decompressStrategy, _sourceFileNameProvider, _targetFileNameProvider); break; } return(0); } catch (Exception ex) { logger.Add("Произошла ошибка. Выполнение программы будет завершено\r\n" + ex.Message + "\r\n" + ex.StackTrace); AddInnerExceptionToLog(ex, logger); return(1); } finally { logger.Close(); } }