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


C# ILogger.LogDebug方法代码示例

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


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

示例1: Initialize

        public bool Initialize(ILogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            bool success;

            this.conversionToolPath = GetExeToolPath(logger);

            if (this.conversionToolPath == null)
            {
                logger.LogWarning(Resources.CONV_WARN_FailToFindConversionTool);
                success = false;
            }
            else
            {
                Debug.Assert(File.Exists(this.conversionToolPath), "Expecting the code coverage exe to exist. Full name: " + this.conversionToolPath);
                logger.LogDebug(Resources.CONV_DIAG_CommandLineToolInfo, this.conversionToolPath);
                success = true;
            }
            return success;
        }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:24,代码来源:CoverageReportConverter.cs

示例2: ComputeVerbosity

        private static LoggerVerbosity ComputeVerbosity(string sonarVerboseValue, string sonarLogValue, ILogger logger)
        {
            if (!String.IsNullOrWhiteSpace(sonarVerboseValue))
            {
                if (sonarVerboseValue.Equals("true", StringComparison.Ordinal))
                {
                    logger.LogDebug(Resources.MSG_SonarVerboseWasSpecified, sonarVerboseValue, LoggerVerbosity.Debug);
                    return LoggerVerbosity.Debug;
                }
                else if (sonarVerboseValue.Equals("false", StringComparison.Ordinal))
                {
                    logger.LogDebug(Resources.MSG_SonarVerboseWasSpecified, sonarVerboseValue, LoggerVerbosity.Info);
                    return LoggerVerbosity.Info;
                }
                else
                {
                    logger.LogWarning(Resources.WARN_SonarVerboseNotBool, sonarVerboseValue);
                }
            }

            if (!String.IsNullOrWhiteSpace(sonarLogValue))
            {
                if (sonarLogValue.Split('|').Any(s => s.Equals(SonarLogDebugValue, StringComparison.Ordinal)))
                {
                    logger.LogDebug(Resources.MSG_SonarLogLevelWasSpecified, sonarLogValue);
                    return LoggerVerbosity.Debug;
                }
            }

            return DefaultLoggingVerbosity;
        }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:31,代码来源:VerbosityCalculator.cs

示例3: TryGetConfig

        public const int DelayBetweenRetriesInMilliseconds = 499; // Period to wait between retries

        #region Public methods

        /// <summary>
        /// Attempts to load the analysis config from the specified directory.
        /// Will retry if the file is locked.
        /// </summary>
        /// <returns>The loaded configuration, or null if the file does not exist or could not be
        /// loaded e.g. due to being locked</returns>
        public static AnalysisConfig TryGetConfig(string configDir, ILogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            AnalysisConfig config = null;
            if (string.IsNullOrEmpty(configDir)) // not specified
            {
                return null;
            }

            string fullAnalysisPath = Path.Combine(configDir, FileConstants.ConfigFileName);
            logger.LogDebug(Resources.Shared_ReadingConfigFile, fullAnalysisPath);
            if (!File.Exists(fullAnalysisPath))
            {
                logger.LogDebug(Resources.Shared_ConfigFileNotFound);
                return null;
            }

            bool succeeded = Utilities.Retry(MaxConfigRetryPeriodInMilliseconds, DelayBetweenRetriesInMilliseconds, logger,
                () => DoLoadConfig(fullAnalysisPath, logger, out config));
            if (succeeded)
            {
                logger.LogDebug(Resources.Shared_ReadingConfigSucceeded, fullAnalysisPath);
            }
            else
            {
                logger.LogError(Resources.Shared_ReadingConfigFailed, fullAnalysisPath);
            }
            return config;
        }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:43,代码来源:TaskUtilities.cs

示例4: RegisterBundles

    /// <summary>
    /// Registers the bundles.
    /// </summary>
    /// <param name="bundles">The bundles.</param>
    /// <param name="logger">The logger.</param>
    public static void RegisterBundles(BundleCollection bundles, ILogger logger)
    {
      logger.LogDebug("START: ModuleConfig.RegisterBundles");
      try
      {
        logger.Indent();
        logger.LogDebug("GetViewModules");
        var vModules = MEFConfig.Container.GetExports<IViewModule>();

        // process each module
        logger.LogDebug("Iterating ViewModules");
        logger.Indent();
        foreach (var module in vModules)
        {
          // get the non lazy module value
          var mod = module.Value; // as IViewModule;

          if (mod != null)
          {
            // add any bundles the module may need
            mod.RegisterBundles(bundles);
          }

          logger.LogDebug(mod.GetType().FullName);
        }
        logger.UnIndent();

      }
      finally
      {
        logger.UnIndent();
        logger.LogDebug("END: ModuleConfig.RegisterBundles");
      }
    }
开发者ID:Jonesie,项目名称:Jonesie.Web,代码行数:39,代码来源:ModuleConfig.cs

示例5: FindWeaverConfigs

    public static List<string> FindWeaverConfigs(string solutionDirectoryPath, string projectDirectory, ILogger logger)
    {
        var files = new List<string>();
        var fodyDirConfigFilePath = Path.Combine(AssemblyLocation.CurrentDirectory, "FodyWeavers.xml");
        if (File.Exists(fodyDirConfigFilePath))
        {
            files.Add(fodyDirConfigFilePath);
            logger.LogDebug(string.Format("Found path to weavers file '{0}'.", fodyDirConfigFilePath));
        }

        var solutionConfigFilePath = Path.Combine(solutionDirectoryPath, "FodyWeavers.xml");
        if (File.Exists(solutionConfigFilePath))
        {
            files.Add(solutionConfigFilePath);
            logger.LogDebug(string.Format("Found path to weavers file '{0}'.", solutionConfigFilePath));
        }

		var projectConfigFilePath = Path.Combine(projectDirectory, "FodyWeavers.xml");
        if (File.Exists(projectConfigFilePath))
        {
            files.Add(projectConfigFilePath);
            logger.LogDebug(string.Format("Found path to weavers file '{0}'.", projectConfigFilePath));
        }


        if (files.Count == 0)
        {
            var pathsSearched = string.Join("', '", fodyDirConfigFilePath, solutionConfigFilePath, projectConfigFilePath);
            logger.LogDebug(string.Format("Could not find path to weavers file. Searched '{0}'.", pathsSearched));
        }
        return files;
    }
开发者ID:GeertvanHorrik,项目名称:Fody,代码行数:32,代码来源:ConfigFileFinder.cs

示例6: Application_Start

    /// <summary>
    /// Start the Application.
    /// </summary>
    protected void Application_Start()
    {
      System.Diagnostics.Trace.WriteLine("{0} :: Application Starting".FormatWith(DateTime.Now.ToString("HH:mm:ss.ff")));

      // MEF will load all the modules from the specified path.
      // Currently this is just the normal bin folder as having them
      // anywhere else can cause problems for the views
      System.Diagnostics.Trace.WriteLine("{0} ::  Initialising MEF".FormatWith(DateTime.Now.ToString("HH:mm:ss.ff")));
      MEFConfig.RegisterMEF(this, Server.MapPath(@"~\bin\"));

      _logger = MEFConfig.Container.GetExport<ILogger>().Value;
      _settings = MEFConfig.Container.GetExport<ISettings>().Value;

      // once mef is configured we can check the database
      CheckDatabase();

      _logger.Indent();
      try
      {
        _logger.LogDebug("Configuring View Engine");
        // Setup a custom view engine.
        // This knows how to deal with views in module folders.
        ViewEngines.Engines.Clear();

        // WARNING!!! Helpers assume that JonesieViewEngine is the first index in the ViewEngines array!!! Changing this
        // will break a lot of things.
        ViewEngines.Engines.Add(new JonesieViewEngine(MEFConfig.Container.GetExports<IViewModule>()));

        // Just the usual MVC startup fluff
        AreaRegistration.RegisterAllAreas();
        AuthConfig.RegisterAuth(_settings);
        WebApiConfig.Register(GlobalConfiguration.Configuration);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

        // need to map the SignalR hub early
        RouteTable.Routes.MapHubs();

        // register routes for service and view modules and bundles for view modules
        ModuleConfig.RegisterRoutes(RouteTable.Routes, GlobalConfiguration.Configuration.Routes, _logger);
        ModuleConfig.RegisterBundles(BundleTable.Bundles, _logger);

        // now that everything else is done we can tell the modules to go ahead and get ready 
        ModuleConfig.InitialiseModules(_logger);

        // register the default routes and bundle after the modules
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);

        // we need to do this early so we can use IsInRole for security trimming the menus
        _logger.LogDebug("Initialising Web Security");
        WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", false);
      }
      finally
      {
        _logger.UnIndent();
      }

      _logger.LogDebug("Application Started");
    }
开发者ID:Jonesie,项目名称:Jonesie.Web,代码行数:62,代码来源:Global.asax.cs

示例7: GetCodeCoverageReportUrls

        /// <summary>
        /// Builds and returns the download URLs for all code coverage reports for the specified build
        /// </summary>
        public IEnumerable<string> GetCodeCoverageReportUrls(string tfsUri, string buildUri, ILogger logger)
        {
            if (string.IsNullOrWhiteSpace(tfsUri))
            {
                throw new ArgumentNullException("tfsUri");
            }
            if (string.IsNullOrWhiteSpace(buildUri))
            {
                throw new ArgumentNullException("buildUri");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            List<string> urls = new List<string>();

            logger.LogDebug(Resources.URL_DIAG_ConnectingToTfs);
            using (TfsTeamProjectCollection collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tfsUri)))
            {
                IBuildServer buildServer = collection.GetService<IBuildServer>();

                logger.LogDebug(Resources.URL_DIAG_FetchingBuildInfo);
                IBuildDetail build = buildServer.GetMinimalBuildDetails(new Uri(buildUri));
                string projectName = build.TeamProject;

                logger.LogDebug(Resources.URL_DIAG_FetchingCoverageReportInfo);
                ITestManagementService tcm = collection.GetService<ITestManagementService>();
                ITestManagementTeamProject testProject = tcm.GetTeamProject(projectName);

                // TODO: investigate further. It looks as if we might be requesting the coverage reports
                // before the service is able to provide them.
                // For the time being, we're retrying with a time out.
                IBuildCoverage[] coverages = null;
                Utilities.Retry(TimeoutInMs, RetryPeriodInMs, logger, () => { return TryGetCoverageInfo(testProject, buildUri, out coverages); });

                foreach (IBuildCoverage coverage in coverages)
                {
                    logger.LogDebug(Resources.URL_DIAG_CoverageReportInfo, coverage.Configuration.Id, coverage.Configuration.BuildPlatform, coverage.Configuration.BuildPlatform);

                    string coverageFileUrl = CoverageReportUrlProvider.GetCoverageUri(build, coverage);
                    Debug.WriteLine(coverageFileUrl);
                    urls.Add(coverageFileUrl);
                }
            }

            logger.LogDebug(Resources.URL_DIAG_Finished);
            return urls;
        }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:52,代码来源:CoverageReportUrlProvider.cs

示例8: CopyIfDifferent

        private static void CopyIfDifferent(string sourcePath, IEnumerable<string> destinationDirs, ILogger logger)
        {
            string sourceContent = GetReadOnlyFileContent(sourcePath);
            string fileName = Path.GetFileName(sourcePath);

            foreach (string destinationDir in destinationDirs)
            {
                string destinationPath = Path.Combine(destinationDir, fileName);

                if (!File.Exists(destinationPath))
                {
                    Directory.CreateDirectory(destinationDir); // creates all the directories in the path if needed
                    File.Copy(sourcePath, destinationPath, overwrite: false);
                    logger.LogDebug(Resources.MSG_InstallTargets_Copy, fileName, destinationDir);
                }
                else
                {
                    string destinationContent = GetReadOnlyFileContent(destinationPath);

                    if (!String.Equals(sourceContent, destinationContent, StringComparison.Ordinal))
                    {
                        File.Copy(sourcePath, destinationPath, overwrite: true);
                        logger.LogDebug(Resources.MSG_InstallTargets_Overwrite, fileName, destinationDir);
                    }
                    else
                    {
                        logger.LogDebug(Resources.MSG_InstallTargets_UpToDate, fileName, destinationDir);
                    }
                }
            }
        }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:31,代码来源:TargetsInstaller.cs

示例9: TryCreateRuleset

        private static bool TryCreateRuleset(ISonarQubeServer server, TeamBuildSettings settings, string projectKey, ILogger logger)
        {
            logger.LogDebug(Resources.SLAP_FetchingSonarLintRuleset);

            string rulesetContent;
            string parametersContent;
            if (TryGetProfileExportForProject(server, projectKey, logger, out rulesetContent, out parametersContent))
            {
                if (IsValidRuleset(rulesetContent))
                {
                    string ruleSetFilePath = GetRulesetFilePath(settings);
                    logger.LogDebug(Resources.SLAP_SonarLintRulesetCreated, ruleSetFilePath);
                    File.WriteAllText(ruleSetFilePath, rulesetContent);

                    string parametersFilePath = GetParametersFilePath(settings);
                    logger.LogDebug(Resources.SLAP_SonarLintParametersCreated, parametersFilePath);
                    File.WriteAllText(parametersFilePath, parametersContent);

                    return true;
                }
                else
                {
                    logger.LogError(Resources.SLAP_InvalidRulesetReturned);
                }
            }
            return false;
        }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:27,代码来源:SonarLintAnalyzerProvider.cs

示例10: SetupAnalyzers

        /// <summary>
        /// Sets up the client to run the SonarLint analyzer as part of the build
        /// i.e. creates the Rolsyn ruleset and provisions the analyzer assemblies
        /// </summary>
        public static void SetupAnalyzers(ISonarQubeServer server, TeamBuildSettings settings, string projectKey, ILogger logger)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (string.IsNullOrWhiteSpace(projectKey))
            {
                throw new ArgumentNullException("projectKey");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            if (IsCSharpPluginInstalled(server))
            {
                if (TryCreateRuleset(server, settings, projectKey, logger))
                {
                    FetchBinaries(server, settings, logger);
                }
            }
            else
            {
                logger.LogDebug(Resources.SLAP_CSharpPluginNotInstalled);
            }
        }
开发者ID:clintcparker,项目名称:sonar-msbuild-runner,代码行数:35,代码来源:SonarLintAnalyzerProvider.cs

示例11: RequestPathAuthenticationPolicy

 public RequestPathAuthenticationPolicy(WebsiteSettings settings, ILogger logger)
 {
     _settings = settings;
     _logger = logger;
     var ignoredFilesSetting = _settings.AnonymousAccessFileExtensions;
     if (ignoredFilesSetting.IsEmpty())
     {
         _logger.LogDebug("Whitelisting authentication for default file extensions: {0}", DefaultExtensionWhiteList);
         ignoredFilesSetting = DefaultExtensionWhiteList;
     }
     else
     {
         _logger.LogDebug("Whitelisting authentication for file extensions from settings : {0}", ignoredFilesSetting);
     }
     _whiteListExtensions = new HashSet<string>(GetWhiteListedExtensions(ignoredFilesSetting), StringComparer.OrdinalIgnoreCase);
 }
开发者ID:skopp,项目名称:dovetail-bootstrap,代码行数:16,代码来源:RequestPathAuthenticationPolicy.cs

示例12: BundleService

 public BundleService(IApplicationEnvironment appEnvironment, ILogger<BundleService> logger)
 {
   _appEnvironment = appEnvironment;
   _logger = logger;
   _logger.LogDebug("Application base path: \"{0}\"", _appEnvironment.ApplicationBasePath);
   _logger.LogInformation("BundleService created");
 }
开发者ID:DasJott,项目名称:DasJottWeb,代码行数:7,代码来源:BundleService.cs

示例13: EnsureEmptyDirectory

        /// <summary>
        /// Ensures that the specified directory exists and is empty
        /// </summary>
        public static void EnsureEmptyDirectory(string directory, ILogger logger)
        {
            if (string.IsNullOrWhiteSpace(directory))
            {
                throw new ArgumentNullException("directory");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            if (Directory.Exists(directory))
            {
                logger.LogDebug(Resources.MSG_DeletingDirectory, directory);
                Directory.Delete(directory, true);
            }
            logger.LogDebug(Resources.MSG_CreatingDirectory, directory);
            Directory.CreateDirectory(directory);
        }
开发者ID:pascalberger,项目名称:sonar-msbuild-runner,代码行数:22,代码来源:Utilities.cs

示例14: TryUpdate

        /// <summary>
        /// Gets a zip file containing the pre/post processors from the server
        /// </summary>
        /// <param name="hostUrl">The server Url</param>
        public bool TryUpdate(string hostUrl, string targetDir, ILogger logger)
        {
            if (string.IsNullOrWhiteSpace(hostUrl))
            {
                throw new ArgumentNullException("hostUrl");
            }
            if (string.IsNullOrWhiteSpace(targetDir))
            {
                throw new ArgumentNullException("targetDir");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            string integrationUrl = GetDownloadZipUrl(hostUrl);
            string downloadedZipFilePath = Path.Combine(targetDir, BootstrapperSettings.SonarQubeIntegrationFilename);

            // SONARMSBRU-169 Support TLS versions 1.0, 1.1 and 1.2
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            using (WebClient client = new WebClient())
            {
                try
                {
                    logger.LogDebug(Resources.MSG_DownloadingZip, BootstrapperSettings.SonarQubeIntegrationFilename, integrationUrl, downloadedZipFilePath);
                    client.DownloadFile(integrationUrl, downloadedZipFilePath);
                }
                catch (WebException ex)
                {
                    if (Utilities.HandleHostUrlWebException(ex, hostUrl, logger))
                    {
                        return false;
                    }
                    logger.LogError(Resources.ERROR_FailedToUpdateRunnerBinaries, ex);
                    return false;
                }

                logger.LogDebug(Resources.MSG_ExtractingFiles, targetDir);
                ZipFile.ExtractToDirectory(downloadedZipFilePath, targetDir);
                return true;
            }
        }
开发者ID:Rinorragi,项目名称:sonar-msbuild-runner,代码行数:47,代码来源:BuildAgentUpdater.cs

示例15: Retry

        /// <summary>
        /// Retries the specified operation until the specified timeout period expires
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="op">The operation to perform. Should return true if the operation succeeded, otherwise false.</param>
        /// <returns>True if the operation succeed, otherwise false</returns>
        public static bool Retry(int timeoutInMilliseconds, int pauseBetweenTriesInMilliseconds, ILogger logger, Func<bool> op)
        {
            if(timeoutInMilliseconds < 1)
            {
                throw new ArgumentOutOfRangeException("timeoutInMilliseconds");
            }
            if (pauseBetweenTriesInMilliseconds < 1)
            {
                throw new ArgumentOutOfRangeException("pauseBetweenTriesInMilliseconds");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (op == null)
            {
                throw new ArgumentNullException("op");
            }
            
            logger.LogDebug(Resources.MSG_BeginningRetry, timeoutInMilliseconds, pauseBetweenTriesInMilliseconds);

            Stopwatch timer = Stopwatch.StartNew();
            bool succeeded = op();

            while (!succeeded && timer.ElapsedMilliseconds < timeoutInMilliseconds)
            {
                logger.LogDebug(Resources.MSG_RetryingOperation);
                System.Threading.Thread.Sleep(pauseBetweenTriesInMilliseconds);
                succeeded = op();
            }

            timer.Stop();

            if (succeeded)
            {
                logger.LogDebug(Resources.MSG_RetryOperationSucceeded, timer.ElapsedMilliseconds);
            }
            else
            {
                logger.LogDebug(Resources.MSG_RetryOperationFailed, timer.ElapsedMilliseconds);
            }
            return succeeded;
        }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:49,代码来源:Utilities.cs


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