本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
}
示例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");
}
示例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);
}