當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。