protected override void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { base.OnUnhandledException(sender, e); var logger = LogManager.GetLogger("DLab"); logger.Error(e.Exception); }
public object CreateLog4NetLogger() { return(new [] { LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), LogManager.GetLogger(typeof(BaseTest)), }); }
protected RemoteCommand() { Log = LogManager.GetLogger(GetType()); Disposable.Add(Cleaner); Formatter = new JsonMediaTypeFormatter { SerializerSettings = JsonHelper.SerializerSettings() }; }
public ProcessViewModel() { _logger = LogManager.GetLogger("ShellView"); ProcessNames = new BindableCollection <ProcessItem>(); _pid = Process.GetCurrentProcess().Id; _chromeTabs = new List <ProcessItem>(); _processList = new List <ProcessItem>(); _mainCancellationTokenSource = new CancellationTokenSource(); Task.Run(() => StartChromeTabListenerAsync(_mainCancellationTokenSource.Token)); }
public static IEnumerable <T> WithCancellation <T>(this IEnumerable <T> en, CancellationToken token) { var logger = LogManager.GetLogger("Default"); foreach (var item in en) { // logger.Debug("[WithCancellation]"); token.ThrowIfCancellationRequested(); yield return(item); } }
public override void Load() { // log4Net Bind <ILog>().ToConstant(LogManager.GetLogger(Assembly.GetEntryAssembly().GetName().Name)); // Caliburn.Micro Bind <IWindowManager>().To <WindowManager>().InSingletonScope(); Bind <IEventAggregator>().To <EventAggregator>().InSingletonScope(); // RatTracker Bind <WebsocketHandler>().ToSelf().InSingletonScope(); Bind <Cache>().ToSelf().InSingletonScope(); Bind <EventBus>().ToSelf().InSingletonScope(); }
protected override void OnStartup(object sender, StartupEventArgs e) { base.OnStartup(sender, e); var fi = new FileInfo("log4net.config"); XmlConfigurator.Configure(fi); _container = new Container(x => { x.For <IWindowManager>().Use <WindowManager>(); x.For <IEventAggregator>().Singleton().Use <EventAggregator>(); x.For <IViewModelFactory>().Use <ViewModelFactory>(); x.For <SettingsViewModel>().Use <SettingsViewModel>(); x.For <CommandViewModel>().Use <CommandViewModel>().Singleton(); x.For <ProcessViewModel>().Use <ProcessViewModel>().Singleton(); x.For <TabViewModel>().Use <TabViewModel>(); x.For <ClipboardViewModel>().Use <ClipboardViewModel>().Singleton(); x.For <HyperspaceViewModel>().Use <HyperspaceViewModel>().Singleton(); x.For <TestViewModel>().Use <TestViewModel>().Singleton(); x.For <SettingsFolderViewModel>().Use <SettingsFolderViewModel>(); x.For <SettingsWebViewModel>().Use <SettingsWebViewModel>(); x.For <SettingsDirViewModel>().Use <SettingsDirViewModel>(); x.For <SettingsRunnerViewModel>().Use <SettingsRunnerViewModel>(); x.For <SettingsHyperViewModel>().Use <SettingsHyperViewModel>(); x.For <FileCommandsRepo>().Use <FileCommandsRepo>().Singleton(); x.For <FolderSpecRepo>().Use <FolderSpecRepo>().Singleton(); x.For <WebSpecRepo>().Use <WebSpecRepo>().Singleton(); x.For <RunnerSpecRepo>().Use <RunnerSpecRepo>().Singleton(); x.For <HyperjumpRepo>().Use <HyperjumpRepo>().Singleton(); x.For <CommandResolver>().Use <CommandResolver>().Singleton(); x.For <ILog>().Use(ctx => LogManager.GetLogger("DLab")); x.Scan(s => { s.TheCallingAssembly(); s.WithDefaultConventions(); s.SingleImplementationsOfInterface(); s.RegisterConcreteTypesAgainstTheFirstInterface(); s.AddAllTypesOf <ITabViewModel>(); }); }); _container.Configure(x => x.For <IContainer>().Use(_container)); EnsureDefaultScanFolders(); DisplayRootViewFor <ShellViewModel>(); // Debug.WriteLine(_container.WhatDoIHave()); }
public void SetUp() { EventLogAppender eventLogAppender = new EventLogAppender(); eventLogAppender.LogName = s_eventLogName; eventLogAppender.ApplicationName = s_eventLogSource; eventLogAppender.SecurityContext = NullSecurityContext.Instance; eventLogAppender.Layout = new PatternLayout("%m\r\n\r\n"); BasicConfigurator.Configure(eventLogAppender); _logger = LogManager.GetLogger("The Name").Logger; _log = new Log4NetLog(_logger); _testEventLog.Clear(); }
public void TearDown() { if (ShowLogOutput) { var logEvents = MemoryAppender.GetEvents().Reverse().ToArray(); Console.WriteLine(logEvents.Skip(1).First().RenderedMessage); Console.WriteLine(logEvents.First().RenderedMessage); } MemoryAppender.Clear(); LogManager.ResetConfiguration(); Assert.That(LogManager.GetLogger(typeof(DiagnosticOutputRuleMergeDecorator)).IsDebugEnabled, Is.False); _serviceLocatorScope.Dispose(); }
public ILogger GetLogger(string name) { if (!loggerCache.ContainsKey(name)) { lock (loggerCacheLock) { if (!loggerCache.ContainsKey(name)) { var logger = new Log4NetLogger(LogManager.GetLogger(name)); loggerCache[name] = logger; } } } return(loggerCache[name]); }
// public Screen ActiveViewModel => ActiveItem as Screen; public ShellViewModel(IWindowManager windowManager, IEventAggregator eventAggregator, IViewModelFactory viewModelFactory) { _windowManager = windowManager; _eventAggregator = eventAggregator; _viewModelFactory = viewModelFactory; _eventAggregator.Subscribe(this); _logger = LogManager.GetLogger("ShellView"); Items.AddRange(new [] { _viewModelFactory.GetViewModel <CommandViewModel>(), _viewModelFactory.GetViewModel <ClipboardViewModel>(), _viewModelFactory.GetViewModel <ProcessViewModel>(), _viewModelFactory.GetViewModel <TestViewModel>() as ITabViewModel // _viewModelFactory.GetViewModel<HyperspaceViewModel>() as ITabViewModel }); ActivateCommandModel(); }
private async Task LoadSelectedPaths() { var selectedFolders = new ObservableCollection <SelectedFile>(); await Task.Run(() => { try { IsBusy = true; if (String.IsNullOrEmpty(this.SourcePath)) { LogManager.GetLogger(typeof(MainViewModel)).Warn("couldn't load subfolders because the source path was null or empty"); } IEnumerable <string> subfolders = this._logic.GetSubfolders(this.SourcePath); int id = 1; foreach (var folder in subfolders) { selectedFolders.Add(new SelectedFile() { ID = id, FilePath = folder, ZipProgress = 0 }); id++; } } finally { IsBusy = false; } }); if (this.SelectedFolders == null) { this.SelectedFolders = new ObservableCollection <SelectedFile>(selectedFolders); } else { this.SelectedFolders.Clear(); this.SelectedFolders.AddRange(selectedFolders); } }
public void ActivateProcessModel() { var processViewModel = (ProcessViewModel)Items.Single(x => x is ProcessViewModel); ActivateItem(processViewModel); #pragma warning disable 4014 try { processViewModel.InitialiseProcessListAsync(); } catch (Exception e) { var logger = LogManager.GetLogger("ShellView"); logger.Error(e); // throw; } #pragma warning restore 4014 _logger.Debug("ActivateProcessModel: Finished"); }
/// <summary> /// 创建<see cref="ILogger" />。 /// </summary> /// <param name="name"></param> /// <returns></returns> public ILogger Create(string name) { return(new Log4NetLogger(LogManager.GetLogger(name))); }
/// <summary> /// 创建<see cref="ILogger" />。 /// </summary> /// <param name="type"></param> /// <returns></returns> public ILogger Create(Type type) { return(new Log4NetLogger(LogManager.GetLogger(type))); }
/// <summary> /// 创建<see cref="ILogger" />。 /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public ILogger Create <T>() { return(new Log4NetLogger(LogManager.GetLogger(typeof(T)))); }
public ILogger GetLogger(Type type) { return(new LogAdapter(LogManager.GetLogger(type))); }
public static ILog GetLogger(string name) => new Log(LogManagerLog4Net.GetLogger(name));
public CaliburnLogger(Type t) { _logger = LogManager.GetLogger(t); }
public ILogger CreateLogger(string name) { StackFrame frame = new StackFrame(3, false); return(new Log4NetLogger(LogManager.GetLogger(frame.GetMethod().DeclaringType.Assembly, name))); }
public object CreateLog4NetFromString() { return(LogManager.GetLogger("my-logger_" + (Interlocked.Increment(ref _log4NetStringLogIndex) % 1000))); }
public void MethodContainingLog4NetNode() { var log = Log4NetLogManager.GetLogger(GetType()); log.Debug("Test"); }
/// <summary> /// 创建指定名称的缓存实例 /// </summary> /// <param name="name">指定名称</param> /// <returns></returns> protected override ILog CreateLogger(string name) { log4net.ILog log = LogManager.GetLogger(name); return(new Log4NetLog(log)); }
/// <summary> /// Gets the Logger and overgive a filename /// </summary> /// <param name="filename"></param> /// <returns></returns> public static ILog GetLogger([CallerFilePath] string filename = "") { return(LogManager.GetLogger(filename)); }