本文整理汇总了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;
}
示例2: RedownloadFailedDownloadService
public RedownloadFailedDownloadService(IConfigService configService, IEpisodeService episodeService, ICommandExecutor commandExecutor, Logger logger)
{
_configService = configService;
_episodeService = episodeService;
_commandExecutor = commandExecutor;
_logger = logger;
}
示例3: TwitterShareService
public TwitterShareService(TwitterPersistenceService twitterPersistenceService,TweetMessageService tweetMessageService)
{
_twitterPersistenceService = twitterPersistenceService;
_tweetMessageService = tweetMessageService;
_logger = LogManager.GetLogger("log");
Authenticate();
}
示例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);
}
示例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(() => "");
}
示例6: NLog
public NLog()
{
// 確保設定檔存在,如果不存在就建立一個設定檔
MakeSureConfigExist();
logger = LogManager.GetLogger("");
}
示例7: DownloadService
public DownloadService(IProvideDownloadClient downloadClientProvider,
IEventAggregator eventAggregator, Logger logger)
{
_downloadClientProvider = downloadClientProvider;
_eventAggregator = eventAggregator;
_logger = logger;
}
示例8: SpinService
public SpinService(IRuntimeInfo runtimeInfo, IProcessProvider processProvider, IStartupContext startupContext, Logger logger)
{
_runtimeInfo = runtimeInfo;
_processProvider = processProvider;
_startupContext = startupContext;
_logger = logger;
}
示例9: PatientController
public PatientController(
IPatientService patientService,
IUnitOfWorkAsync unitOfWork) : base(unitOfWork)
{
_patientService = patientService;
_logger = LogManager.GetLogger(GetType().Name);
}
示例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);
}
示例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;
}
示例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;
}
示例13: createLogger
static Logger createLogger(string name)
{
var logger = new Logger(name);
logger.logLevel = globalLogLevel;
logger.OnLog += _appenders;
return logger;
}
示例14: RemoveAppender
public static void RemoveAppender(Logger.LogDelegate appender)
{
_appenders -= appender;
foreach (var logger in _loggers.Values) {
logger.OnLog -= appender;
}
}
示例15: AddAppender
public static void AddAppender(Logger.LogDelegate appender)
{
_appenders += appender;
foreach (var logger in _loggers.Values) {
logger.OnLog += appender;
}
}