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


C# LoggerVerbosity类代码示例

本文整理汇总了C#中LoggerVerbosity的典型用法代码示例。如果您正苦于以下问题:C# LoggerVerbosity类的具体用法?C# LoggerVerbosity怎么用?C# LoggerVerbosity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: BuildAsync

    internal static async Task<BuildResult> BuildAsync(this BuildManager buildManager, ITestOutputHelper logger, ProjectCollection projectCollection, ProjectRootElement project, string target, IDictionary<string, string> globalProperties = null, LoggerVerbosity logVerbosity = LoggerVerbosity.Detailed, ILogger[] additionalLoggers = null)
    {
        Requires.NotNull(buildManager, nameof(buildManager));
        Requires.NotNull(projectCollection, nameof(projectCollection));
        Requires.NotNull(project, nameof(project));

        globalProperties = globalProperties ?? new Dictionary<string, string>();
        var projectInstance = new ProjectInstance(project, globalProperties, null, projectCollection);
        var brd = new BuildRequestData(projectInstance, new[] { target }, null, BuildRequestDataFlags.ProvideProjectStateAfterBuild);

        var parameters = new BuildParameters(projectCollection);

        var loggers = new List<ILogger>();
        loggers.Add(new ConsoleLogger(logVerbosity, s => logger.WriteLine(s.TrimEnd('\r', '\n')), null, null));
        loggers.AddRange(additionalLoggers);
        parameters.Loggers = loggers.ToArray();

        buildManager.BeginBuild(parameters);

        var result = await buildManager.BuildAsync(brd);

        buildManager.EndBuild();

        return result;
    }
开发者ID:azeno,项目名称:Nerdbank.GitVersioning,代码行数:25,代码来源:MSBuildExtensions.cs

示例2: BuildScenario

    public static ITargetResult BuildScenario(string scenarioName, object properties = null, string target = "GetPackageContents", ITestOutputHelper output = null, LoggerVerbosity? verbosity = null)
    {
        var projectName = scenarioName;
        if (scenarioName.StartsWith("given", StringComparison.OrdinalIgnoreCase))
            projectName = string.Join("_", scenarioName.Split('_').Skip(2));

        var scenarioDir = Path.Combine(ModuleInitializer.BaseDirectory, "Scenarios", scenarioName);
        string projectOrSolution;

        if (File.Exists(Path.Combine(scenarioDir, $"{projectName}.csproj")))
            projectOrSolution = Path.Combine(scenarioDir, $"{projectName}.csproj");
        else
            projectOrSolution = Directory.EnumerateFiles(scenarioDir, "*.csproj").First();

        var logger = default(ILogger);
        if (output != null)
        {
            if (verbosity == null)
            {
                var data = Thread.GetNamedDataSlot(nameof(LoggerVerbosity));
                if (data != null)
                    verbosity = (LoggerVerbosity?)Thread.GetData(data);
            }

            logger = new TestOutputLogger(output, verbosity);
        }

        if (properties != null)
            return Build(projectOrSolution, target,
                properties: properties.GetType().GetProperties().ToDictionary(prop => prop.Name, prop => prop.GetValue(properties).ToString()),
                logger: logger)[target];
        else
            return Build(projectOrSolution, target, logger: logger)[target];
    }
开发者ID:xamarin,项目名称:NuGetizer3000,代码行数:34,代码来源:Builder.NuGetizer.cs

示例3: CmdLineBuilder

		public CmdLineBuilder(CSBuildConfig config, LoggerVerbosity? verbosity, string groups, string[] targetNames, string[] propertySets)
		{
			_config = config;
			_verbosity = verbosity;
			_groups = groups;
			_targetNames = targetNames;
			_propertySets = propertySets;
			_thread = new System.Threading.Thread(this.Build);
		}
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:9,代码来源:CmdLineBuilder.cs

示例4: SDConsoleLogger

		public SDConsoleLogger(IBuildFeedbackSink feedbackSink, LoggerVerbosity verbosity)
			: base(verbosity)
		{
			if (feedbackSink == null)
				throw new ArgumentNullException("feedbackSink");
			this.feedbackSink = feedbackSink;
			this.ShowSummary = false;
			base.WriteHandler = Write;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:SDConsoleLogger.cs

示例5: InitializeConsoleMethods

 /// <summary>
 /// Initializes the logger, with alternate output handlers.
 /// </summary>
 /// <param name="verbosity"></param>
 /// <param name="write"></param>
 /// <param name="colorSet"></param>
 /// <param name="colorReset"></param>
 public SerialConsoleLogger
 (
     LoggerVerbosity verbosity,
     WriteHandler write,
     ColorSetter colorSet,
     ColorResetter colorReset
 )
 {
     InitializeConsoleMethods(verbosity, write, colorSet, colorReset);
 }
开发者ID:cameron314,项目名称:msbuild,代码行数:17,代码来源:SerialConsoleLogger.cs

示例6: DebugMctLogger

        /// <summary>
        /// Creates a new instance of the <see cref="DebugMctLogger" /> class.
        /// </summary>
        /// <param name="verbosity">The verbosity of the <see cref="MctLogger" />.</param>
        public DebugMctLogger(LoggerVerbosity verbosity)
        {
            Verbosity = verbosity;

            if (!Debugger.IsAttached)
                try
                {
                    Debugger.Launch();
                }
                catch { }
        }
开发者ID:mugmickey,项目名称:PoroCYon.MCT,代码行数:15,代码来源:DebugMctLogger.cs

示例7: CheckVerbosity

        private static void CheckVerbosity(string errorMessage, LoggerVerbosity expectedVerbosity, string verbosity = null, string logLevel = null, int expectedNumberOfWarnings = 0)
        {
            var provider = CreatePropertiesProvider(verbosity, logLevel);
            TestLogger logger = new TestLogger();

            var actualVerbosity = VerbosityCalculator.ComputeVerbosity(provider, logger);

            Assert.AreEqual(expectedVerbosity, actualVerbosity, errorMessage);

            logger.AssertErrorsLogged(0);
            logger.AssertWarningsLogged(expectedNumberOfWarnings);
        }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:12,代码来源:VerbosityCalculatorTests.cs

示例8: ConsoleLogger

 /// <summary>
 /// Create a logger instance with a specific verbosity.  This logs to
 /// the default console.
 /// </summary>
 /// <param name="verbosity">Verbosity level.</param>
 public ConsoleLogger(LoggerVerbosity verbosity)
     :
     this
     (
         verbosity,
         new WriteHandler(Console.Out.Write),
         new ColorSetter(BaseConsoleLogger.SetColor),
         new ColorResetter(BaseConsoleLogger.ResetColor)
     )
 {
     // do nothing
 }
开发者ID:nikson,项目名称:msbuild,代码行数:17,代码来源:ConsoleLogger.cs

示例9: Register

        public static RegisterLoggerResult Register(
            Guid loggerId, 
            LoggerVerbosity loggerVerbosity, 
            out BuildOutputLogger buildLogger)
        {
            try
            {
                const BindingFlags InterfacePropertyFlags = BindingFlags.GetProperty
                                                            | BindingFlags.Public
                                                            | BindingFlags.Instance;

                BuildManager buildManager = BuildManager.DefaultBuildManager;
                Type buildHostType = buildManager.GetType().Assembly.GetType("Microsoft.Build.BackEnd.IBuildComponentHost");
                PropertyInfo loggingSeviceProperty = buildHostType.GetProperty("LoggingService", InterfacePropertyFlags);

                object loggingServiceObj;
                try
                {
                    // Microsoft.Build.BackEnd.ILoggingService
                    loggingServiceObj = loggingSeviceProperty.GetValue(buildManager, null);
                }
                catch (TargetInvocationException ex)
                {
                    ex.Trace("Microsoft.Build.BackEnd.ILoggingService is not available.");
                    buildLogger = null;
                    return RegisterLoggerResult.FatalError;
                }

                PropertyInfo loggersProperty = loggingServiceObj.GetType().GetProperty("Loggers", InterfacePropertyFlags);
                ICollection<ILogger> loggers = (ICollection<ILogger>)loggersProperty.GetValue(loggingServiceObj, null);

                ILogger logger = loggers.FirstOrDefault(x => x is BuildOutputLogger && ((BuildOutputLogger)x)._id.Equals(loggerId));
                if (logger != null)
                {
                    buildLogger = (BuildOutputLogger)logger;
                    buildLogger.Verbosity = loggerVerbosity;
                    return RegisterLoggerResult.AlreadyExists;
                }

                MethodInfo registerLoggerMethod = loggingServiceObj.GetType().GetMethod("RegisterLogger");
                buildLogger = new BuildOutputLogger(loggerId) { Verbosity = loggerVerbosity };
                bool registerResult = (bool)registerLoggerMethod.Invoke(loggingServiceObj, new object[] { buildLogger });

                return registerResult ? RegisterLoggerResult.RegisterSuccess : RegisterLoggerResult.RegisterFailed;
            }
            catch (Exception ex)
            {
                ex.TraceUnknownException();
                buildLogger = null;
                return RegisterLoggerResult.FatalError;
            }
        }
开发者ID:ashwinsathyar,项目名称:BuildVision,代码行数:52,代码来源:BuildOutputLogger.cs

示例10: ConsoleLogger

		public ConsoleLogger (LoggerVerbosity verbosity, WriteHandler write, ColorSetter colorSet, ColorResetter colorReset)
		{
			if (write == null)
				throw new ArgumentNullException ("write");
			if (colorSet == null)
				throw new ArgumentNullException ("colorSet");
			if (colorReset == null)
				throw new ArgumentNullException ("colorReset");
			Verbosity = verbosity;
			this.write = write;
			set_color = colorSet;
			reset_color = colorReset;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:ConsoleLogger.cs

示例11: AssemblyLoadInfo

 /// <summary>
 /// Creates a logger description from given data
 /// </summary>
 public LoggerDescription
 (
     string loggerClassName,
     string loggerAssemblyName,
     string loggerAssemblyFile,
     string loggerSwitchParameters,
     LoggerVerbosity verbosity
 )
 {
     this.loggerClassName = loggerClassName;
     this.loggerAssembly = new AssemblyLoadInfo(loggerAssemblyName, loggerAssemblyFile);
     this.loggerSwitchParameters = loggerSwitchParameters;
     this.verbosity = verbosity;
 }
开发者ID:nikson,项目名称:msbuild,代码行数:17,代码来源:LoggerDescription.cs

示例12: LoggerDescription

		public LoggerDescription (string loggerClassName, string loggerAssemblyName,
				string loggerAssemblyFile, string loggerSwitchParameters,
				LoggerVerbosity verbosity)
		{
			if (loggerAssemblyName != null && loggerAssemblyFile != null)
				throw new InvalidOperationException ("Cannot specify both loggerAssemblyName and loggerAssemblyFile at the same time.");
			if (loggerAssemblyName == null && loggerAssemblyFile == null)
				throw new InvalidOperationException ("Either loggerAssemblyName or loggerAssemblyFile must be specified");
			class_name = loggerClassName;
			assembly_name = loggerAssemblyName;
			assembly_file = loggerAssemblyFile;
			LoggerSwitchParameters = loggerSwitchParameters;
			Verbosity = verbosity;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:14,代码来源:LoggerDescription.cs

示例13: Parameters

		public Parameters ()
		{
			consoleLoggerParameters = "";
			displayHelp = false;
			loggers = new ArrayList ();
			loggerVerbosity = LoggerVerbosity.Normal;
			noConsoleLogger = false;
			noLogo = false;
			properties = new BuildPropertyGroup ();
			targets = new string [0];
			
			responseFile = Path.Combine (
					Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location),
					"xbuild.rsp");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:15,代码来源:Parameters.cs

示例14: BootstrapperSettings

        public BootstrapperSettings(AnalysisPhase phase, IEnumerable<string> childCmdLineArgs, string sonarQubeUrl, LoggerVerbosity verbosity, ILogger logger)
        {
            if (sonarQubeUrl == null)
            {
                throw new ArgumentNullException("sonarQubeUrl");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            this.sonarQubeUrl = sonarQubeUrl;
            this.analysisPhase = phase;
            this.childCmdLineArgs = childCmdLineArgs;
            this.verbosity = verbosity;

            this.logger = logger;
        }
开发者ID:BrightLight,项目名称:sonar-msbuild-runner,代码行数:18,代码来源:BootstrapperSettings.cs

示例15:

        /// <summary>
        /// Creates a logger description from given data
        /// </summary>
        public LoggerDescription
        (
            string loggerClassName,
            string loggerAssemblyName,
            string loggerAssemblyFile,
            string loggerSwitchParameters,
            LoggerVerbosity verbosity
        )
        {
            _loggerClassName = loggerClassName;

            if (loggerAssemblyFile != null && !Path.IsPathRooted(loggerAssemblyFile))
            {
                loggerAssemblyFile = FileUtilities.NormalizePath(loggerAssemblyFile);
            }

            _loggerAssembly = AssemblyLoadInfo.Create(loggerAssemblyName, loggerAssemblyFile);
            _loggerSwitchParameters = loggerSwitchParameters;
            _verbosity = verbosity;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:23,代码来源:LoggerDescription.cs


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