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


C# ILogger.WriteEntry方法代码示例

本文整理汇总了C#中ILogger.WriteEntry方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.WriteEntry方法的具体用法?C# ILogger.WriteEntry怎么用?C# ILogger.WriteEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILogger的用法示例。


在下文中一共展示了ILogger.WriteEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Grab

        public override List<Show> Grab(string xmlParameters, ILogger logger)
        {
            logger.WriteEntry("Started sky.it grab", LogType.Info);

            var selectedChannels = new List<Channel>();
            var shows = new List<Show>();
            if (!string.IsNullOrEmpty(xmlParameters))
            {
                var doc = XDocument.Parse(xmlParameters);
                foreach (var c in doc.Descendants("Channel"))
                    selectedChannels.Add((Channel)Enum.Parse(typeof(Channel), c.Value));
            }
            if (selectedChannels.Count == 0) // no channel specified , lets take all available channels
                foreach (Channel c in Enum.GetValues(typeof(Channel)))
                    selectedChannels.Add(c);

            foreach (var c in selectedChannels)
            {
                var p = new GrabParameters();
                p.Channel = c;
                var channelShows = Grab(p, logger).OrderBy(x => x.StartTime).ToList() ;
                FixShowsEndTimeByStartTime(channelShows);
                shows.AddRange(channelShows);
            }

            logger.WriteEntry("Finshed sky.it grab", LogType.Info);
            return shows;
        }
开发者ID:hagaygo,项目名称:XmlTvGenerator,代码行数:28,代码来源:WebSiteGrabber.cs

示例2: TranslateShows

        public void TranslateShows(List<Show> shows, Language sourceLang, Language targetLang, ILogger logger)
        {
            Debug.WriteLine("Found {0} Shows", shows.Count);
            Debug.WriteLine("Started Translating...");
            int counter = 0;

            var lockObject = new object();
            var lastTime = DateTime.Now;
            Parallel.ForEach(shows, new ParallelOptions() { MaxDegreeOfParallelism = 8 }, show =>
            {
                show.Title = Tools.CleanupText(Translate(sourceLang, targetLang, show.Title));
                if (!string.IsNullOrEmpty(show.Description))
                    show.Description = Tools.CleanupText(Translate(sourceLang, targetLang, show.Description));
                lock (lockObject)
                {
                    counter++;
                }
                if (DateTime.Now - lastTime > TimeSpan.FromSeconds(30))
                {
                    lastTime = DateTime.Now;
                    var text = string.Format("Translator Finished {0}/{1} {2:0.00}%", counter, shows.Count, counter * 100.0 / shows.Count);
                    Debug.WriteLine(text);
                    lock (lockObject)
                        logger.WriteEntry(text, LogType.Info);
                }
            }
            );
            Cache.SaveCache();
            Debug.WriteLine("Finished Translating.");
        }
开发者ID:hagaygo,项目名称:XmlTvGenerator,代码行数:30,代码来源:TranslatorBase.cs


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