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


C# ILogger.?.Info方法代码示例

本文整理汇总了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");
        }
开发者ID:Eldblom,项目名称:Unicorn,代码行数:19,代码来源:SyncedItemPostProcessor.cs

示例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.");
        }
开发者ID:Eldblom,项目名称:Unicorn,代码行数:14,代码来源:SyncedItemPostProcessor.cs

示例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;
            }
        }
开发者ID:geffzhang,项目名称:Foundatio,代码行数:36,代码来源:JobRunner.cs


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