當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。