本文整理汇总了C#中ILogger.?.Info方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.?.Info方法的具体用法?C# ILogger.?.Info怎么用?C# ILogger.?.Info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.?.Info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateLinkDatabase
protected virtual void UpdateLinkDatabase(Item[] items, ILogger logger)
{
logger?.Info("");
logger?.Info("[L] Updating link database for changed items.");
Stopwatch sw = new Stopwatch();
sw.Start();
foreach (var item in items)
{
Globals.LinkDatabase.UpdateReferences(item);
// NOTE: we don't have a reference to deleted items. This means that due to the link DB API requiring an Item parameter, we can't really remove deleted items from the LDB.
}
sw.Stop();
logger?.Debug($"> Updated {items.Length} items in the link database in {(sw.ElapsedMilliseconds / 1000):F2} sec");
}
示例2: UpdateSearchIndexes
protected virtual void UpdateSearchIndexes(Item[] items, ILogger logger)
{
logger?.Info("");
logger?.Info("[I] Updating search indexes for changed items.");
foreach (var index in ContentSearchManager.Indexes)
{
var changes = items.Select(change => new SitecoreItemUniqueId(change.Uri));
IndexCustodian.IncrementalUpdate(index, changes);
}
logger?.Debug($"> Queued updates for {items.Length} items in the search indexes. Will run async.");
}
示例3: GetShutdownCancellationToken
public static CancellationToken GetShutdownCancellationToken(ILogger logger = null) {
if (_jobShutdownCancellationTokenSource != null)
return _jobShutdownCancellationTokenSource.Token;
lock (_lock) {
if (_jobShutdownCancellationTokenSource != null)
return _jobShutdownCancellationTokenSource.Token;
_jobShutdownCancellationTokenSource = new CancellationTokenSource();
ShutdownEventCatcher.Shutdown += args => {
_jobShutdownCancellationTokenSource.Cancel();
logger?.Info("Job shutdown event signaled: {0}", args.Reason);
};
var webJobsShutdownFile = Environment.GetEnvironmentVariable("WEBJOBS_SHUTDOWN_FILE");
if (String.IsNullOrEmpty(webJobsShutdownFile))
return _jobShutdownCancellationTokenSource.Token;
var handler = new FileSystemEventHandler((s, e) => {
if (e.FullPath.IndexOf(Path.GetFileName(webJobsShutdownFile), StringComparison.OrdinalIgnoreCase) < 0)
return;
_jobShutdownCancellationTokenSource.Cancel();
logger?.Info("Job shutdown signaled.");
});
var watcher = new FileSystemWatcher(Path.GetDirectoryName(webJobsShutdownFile));
watcher.Created += handler;
watcher.Changed += handler;
watcher.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.FileName | NotifyFilters.LastWrite;
watcher.IncludeSubdirectories = false;
watcher.EnableRaisingEvents = true;
return _jobShutdownCancellationTokenSource.Token;
}
}