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


C# Logger.LogDebugMessage方法代码示例

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


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

示例1: AfterCrawl

        public void AfterCrawl(Uri outputFolder, Dictionary<Uri, string> pages, Dictionary<Uri, string> resources, Logger logger)
        {
            foreach (var resource in resources.Keys.ToArray().Where(resource => Path.GetExtension(resource.LocalPath).Equals(".JS", StringComparison.OrdinalIgnoreCase)))
            {
                logger.LogDebugMessage("Optimizing " + outputFolder.MakeRelativeUri(resource));
                var externsFileName = GetExternsFilePath(resource.LocalPath);

                // ReSharper disable PossibleNullReferenceException
                Process.Start(
                    new ProcessStartInfo(
                        fileName: "java",
                        arguments:
                            string.Format(
                                @"-jar libs\compiler.jar --js=""{0}"" --js_output_file=""{0}"" --warning_level VERBOSE --externs=""{1}""",
                                resource.LocalPath,
                                externsFileName))
                    {
                        WorkingDirectory = Environment.CurrentDirectory,
                        UseShellExecute = !logger.InDebugMode,
                        RedirectStandardOutput = logger.InDebugMode,
                    }).WaitForExit();

                // ReSharper restore PossibleNullReferenceException
                File.Delete(externsFileName);
            }
        }
开发者ID:bdukes,项目名称:Website-Optimizer,代码行数:26,代码来源:JavaScriptOptimizationProcessor.cs

示例2: BeforeCrawl

 public void BeforeCrawl(Uri outputFolder, Logger logger)
 {
     try
     {
         Directory.Delete(outputFolder.LocalPath, true);
     }
     catch (IOException exc)
     {
         logger.LogDebugMessage("Error clearing output folder: {0}", exc.Message);
     }
 }
开发者ID:bdukes,项目名称:Website-Optimizer,代码行数:11,代码来源:FileOutputProcessor.cs

示例3: VerifyDirectoryExists

        private static bool VerifyDirectoryExists(string directoryName, Logger logger, out string errorMessage)
        {
            errorMessage = null;
            if (Directory.Exists(directoryName))
            {
                return true;
            }

            try
            {
                Directory.CreateDirectory(directoryName);
                return true;
            }
            catch (IOException exc)
            {
                errorMessage = "IOException trying to create directory: " + exc.Message;
                logger.LogDebugMessage(errorMessage);
                return false;
            }
        }
开发者ID:bdukes,项目名称:Website-Optimizer,代码行数:20,代码来源:FileOutputProcessor.cs

示例4: GetResources

        private void GetResources(Uri outputFolder, Func<Uri, bool> isLocalUrl, Dictionary<Uri, string> pages, Dictionary<Uri, string> resources, Uri pageUrl, HtmlDocument pageDocument, Logger logger)
        {
            var resourcesUrls = pageDocument.GetResourcesUrls(outputFolder, isLocalUrl, resources, pageUrl);

            using (var webClient = new WebClient())
            {
                foreach (var resourceUrls in resourcesUrls)
                {
                    var localResourcePath = resourceUrls.FilePath.LocalPath;
                    logger.LogDebugMessage("Saving resource {0} to {1}", pageUrl, localResourcePath);

                    string errorMessage;
                    if (!VerifyDirectoryExists(Path.GetDirectoryName(localResourcePath), logger, out errorMessage))
                    {
                        pages[pageUrl] = errorMessage;
                        continue;
                    }

                    webClient.DownloadFile(resourceUrls.ResourceUrl, localResourcePath);

                    resources.Add(resourceUrls.FilePath, null);
                }
            }
        }
开发者ID:bdukes,项目名称:Website-Optimizer,代码行数:24,代码来源:FileOutputProcessor.cs

示例5: ProcessPage

 public void ProcessPage(Uri outputFolder, Func<Uri, bool> isLocalUrl, Dictionary<Uri, string> pages, Dictionary<Uri, string> resources, Uri pageUrl, HtmlDocument pageDocument, Logger logger)
 {
     logger.LogDebugMessage("Image optimization not yet implemented");
 }
开发者ID:bdukes,项目名称:Website-Optimizer,代码行数:4,代码来源:ImageOptimizationProcessor.cs

示例6: SavePageFile

        private void SavePageFile(Uri outputFolder, Dictionary<Uri, string> pages, Uri pageUrl, HtmlDocument pageDocument, Logger logger)
        {
            var relativeFilePath = Path.Combine(pageUrl.LocalPath.Substring(1), PageFileName);
            var filename = new Uri(outputFolder, relativeFilePath).LocalPath;
            logger.LogDebugMessage("Saving page {0} to {1}", pageUrl, filename);

            string errorMessage;
            if (!VerifyDirectoryExists(Path.GetDirectoryName(filename), logger, out errorMessage))
            {
                pages[pageUrl] = errorMessage;
                return;
            }

            pageDocument.Save(filename);
        }
开发者ID:bdukes,项目名称:Website-Optimizer,代码行数:15,代码来源:FileOutputProcessor.cs


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