当前位置: 首页>>代码示例>>C#>>正文


C# NLog.Logger类代码示例

本文整理汇总了C#中NLog.Logger的典型用法代码示例。如果您正苦于以下问题:C# Logger类的具体用法?C# Logger怎么用?C# Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Logger类属于NLog命名空间,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MessagePipelineBase

 protected MessagePipelineBase(IMessageHandlerProvider messageHandlerProvider, ILifetimeScope lifetimeScope, IMessage message, Logger logger)
     : base(logger)
 {
     _messageHandlerProvider = messageHandlerProvider;
     LifetimeScope = lifetimeScope;
     Message = message;
 }
开发者ID:GasiorowskiPiotr,项目名称:NRabbitBus,代码行数:7,代码来源:MessagePipelineBase.cs

示例2: RedownloadFailedDownloadService

 public RedownloadFailedDownloadService(IConfigService configService, IEpisodeService episodeService, ICommandExecutor commandExecutor, Logger logger)
 {
     _configService = configService;
     _episodeService = episodeService;
     _commandExecutor = commandExecutor;
     _logger = logger;
 }
开发者ID:Kiljoymccoy,项目名称:NzbDrone,代码行数:7,代码来源:RedownloadFailedDownloadService.cs

示例3: TwitterShareService

 public TwitterShareService(TwitterPersistenceService twitterPersistenceService,TweetMessageService tweetMessageService)
 {
     _twitterPersistenceService = twitterPersistenceService;
     _tweetMessageService = tweetMessageService;
     _logger = LogManager.GetLogger("log");
     Authenticate();
 }
开发者ID:desautel,项目名称:Sdl-Community,代码行数:7,代码来源:TwitterShareService.cs

示例4: Index

        // GET: Movies
        public ActionResult Index(string movieGenre, string searchString)
        {
            var GenreLst = new List<string>();

            var GenreQry = from d in db.Movies
                           orderby d.Genre
                           select d.Genre;

            GenreLst.AddRange(GenreQry.Distinct());
            ViewBag.movieGenre = new SelectList(GenreLst);

            var movies = from m in db.Movies
                         select m;

            if (!String.IsNullOrEmpty(searchString))
            {
                movies = movies.Where(s => s.Title.Contains(searchString));
            }

            if (!string.IsNullOrEmpty(movieGenre))
            {
                movies = movies.Where(x => x.Genre == movieGenre);
            }

            var config = LogManager.Configuration;
            string basedirPath = AppDomain.CurrentDomain.BaseDirectory;
#if TRACE
            logger = NLog.LogManager.GetLogger("rule1");
            logger.Info("\n{0}", movies);
#endif
            return View(movies);
        }
开发者ID:chao1017,项目名称:MVC5_Labs,代码行数:33,代码来源:MoviesController.cs

示例5: NLogLog

 /// <summary>
 /// Create a new NLog logger instance.
 /// </summary>
 /// <param name="name">Name of type to log as.</param>
 public NLogLog([NotNull] NLog.Logger log, [NotNull] string name)
 {
     if (name == null)
         throw new ArgumentNullException("name");
     _log = log;
     _log.Debug(() => "");
 }
开发者ID:raelyard,项目名称:Topshelf,代码行数:11,代码来源:NLogLog.cs

示例6: NLog

        public NLog()
        {
            // 確保設定檔存在,如果不存在就建立一個設定檔
            MakeSureConfigExist();

            logger = LogManager.GetLogger("");
        }
开发者ID:skt90u,项目名称:skt90u-framework-dotnet,代码行数:7,代码来源:NLog.cs

示例7: DownloadService

 public DownloadService(IProvideDownloadClient downloadClientProvider,
     IEventAggregator eventAggregator, Logger logger)
 {
     _downloadClientProvider = downloadClientProvider;
     _eventAggregator = eventAggregator;
     _logger = logger;
 }
开发者ID:peterlandry,项目名称:NzbDrone,代码行数:7,代码来源:DownloadService.cs

示例8: SpinService

 public SpinService(IRuntimeInfo runtimeInfo, IProcessProvider processProvider, IStartupContext startupContext, Logger logger)
 {
     _runtimeInfo = runtimeInfo;
     _processProvider = processProvider;
     _startupContext = startupContext;
     _logger = logger;
 }
开发者ID:Djohnnie,项目名称:Sonarr,代码行数:7,代码来源:SpinService.cs

示例9: PatientController

 public PatientController(
     IPatientService patientService,
     IUnitOfWorkAsync unitOfWork) : base(unitOfWork)
 {
     _patientService = patientService;
      _logger = LogManager.GetLogger(GetType().Name);
 }
开发者ID:sowenzhang,项目名称:HospitalWeightMonitor,代码行数:7,代码来源:PatientController.cs

示例10: Exit

 static void Exit(Logger logger, CancellationTokenSource src, ExtensionRunnerExitCode exitCode)
 {
     if(logger != null)
         logger.Info("Exiting (code: " + exitCode + ")");
     src.Cancel();
     Environment.Exit((int)exitCode);
 }
开发者ID:huoxudong125,项目名称:ServerX,代码行数:7,代码来源:Program.cs

示例11: GetJob

        public static Job GetJob(int jobId, Logger defaultLogger)
        {
            Job currentJob;
            using (var repo = new JobRepository())
            {
                defaultLogger.Info("Passed job with ID of {0}", jobId);

                currentJob = repo.GetJobById(jobId);

                if (currentJob == null)
                {
                    defaultLogger.Warn("Job not found");
                    return null;
                }

                defaultLogger.Info("Job found. URL is {0} and branch is {1}", currentJob.Url, currentJob.Branch);

                if (currentJob.State != JobState.Pending)
                {
                    defaultLogger.Warn("Cannot start job. Current state is {0}", currentJob.State);
                    return null;
                }

                repo.UpdateStateForJob(currentJob, JobState.Running);
            }

            return currentJob;
        }
开发者ID:tompoole,项目名称:DeploymentManager,代码行数:28,代码来源:JobHelper.cs

示例12: Run

        private int Run()
        {
            Bootstrap();
            _logger = _container.Resolve<Logger>();

            var exitCode = HostFactory.Run(host =>
            {
                host.Service<RefreshService>(svc =>
                {
                    svc.ConstructUsing(() =>
                    {
                        var agent = new RefreshService(RefreshInterval, () => _container.Resolve<RabbitMonitorRepository>() as RabbitMonitorRepository);

                        agent.OnReport += (s, e) => _logger.Trace(e.Data);
                        agent.OnError += (s, e) => _logger.Fatal(e.Data);

                        return agent;
                    });

                    svc.WhenStarted(a => a.Start());
                    svc.WhenStopped(a => a.Stop());
                });

                host.SetDescription("Refresh Service Agent for RabbitMQ");
                host.SetDisplayName("RabbitMQ Refresh Agent");
                host.SetServiceName("RabbitMQRefreshAgent");
                host.RunAsNetworkService();
            });

            return (int)exitCode;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:31,代码来源:Program.cs

示例13: createLogger

 static Logger createLogger(string name)
 {
     var logger = new Logger(name);
     logger.logLevel = globalLogLevel;
     logger.OnLog += _appenders;
     return logger;
 }
开发者ID:sschmid,项目名称:NLog,代码行数:7,代码来源:LoggerFactory.cs

示例14: RemoveAppender

 public static void RemoveAppender(Logger.LogDelegate appender)
 {
     _appenders -= appender;
     foreach (var logger in _loggers.Values) {
         logger.OnLog -= appender;
     }
 }
开发者ID:sschmid,项目名称:NLog,代码行数:7,代码来源:LoggerFactory.cs

示例15: AddAppender

 public static void AddAppender(Logger.LogDelegate appender)
 {
     _appenders += appender;
     foreach (var logger in _loggers.Values) {
         logger.OnLog += appender;
     }
 }
开发者ID:sschmid,项目名称:NLog,代码行数:7,代码来源:LoggerFactory.cs


注:本文中的NLog.Logger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。