本文整理汇总了C#中LoggerVerbosity类的典型用法代码示例。如果您正苦于以下问题:C# LoggerVerbosity类的具体用法?C# LoggerVerbosity怎么用?C# LoggerVerbosity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoggerVerbosity类属于命名空间,在下文中一共展示了LoggerVerbosity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ContentBuilder
public ContentBuilder(string contentProjectFile, GraphicsProfile graphicsProfile = GraphicsProfile.HiDef, TargetPlatform targetPlatform = TargetPlatform.Windows, bool compressContent = true, LoggerVerbosity loggerVerbosity = LoggerVerbosity.Normal, bool rebuildContent = false)
{
FileInfo fileInfo = new FileInfo(contentProjectFile);
_contentProjectFile = Path.GetFullPath(fileInfo.FullName);
if (fileInfo.Extension != ".contentproj")
throw new NotSupportedException(string.Format("The file '{0}' is not a XNA content project.", _contentProjectFile));
if (!fileInfo.Exists)
throw new FileNotFoundException(String.Format("The file '{0}' does not exist.", _contentProjectFile, _contentProjectFile));
GraphicsProfile = graphicsProfile;
TargetPlatform = targetPlatform;
CompressContent = compressContent;
LoggerVerbosity = loggerVerbosity;
RebuildContent = rebuildContent;
if (!_globalProperties.ContainsKey("XnaProfile"))
_globalProperties.Add("XnaProfile", GraphicsProfile.ToString());
if (!_globalProperties.ContainsKey("XNAContentPipelineTargetPlatform"))
_globalProperties.Add("XNAContentPipelineTargetPlatform", TargetPlatform.ToString());
if (!_globalProperties.ContainsKey("XnaCompressContent"))
_globalProperties.Add("XnaCompressContent", CompressContent.ToString());
if (!_globalProperties.ContainsKey("OutputhPath"))
_globalProperties.Add("OutputPath", OutputPath);
if (!_globalProperties.ContainsKey("ContentRootDirectory"))
_globalProperties.Add("ContentRootDirectory", ContentRootDirectory);
}
开发者ID:Raidenthequick,项目名称:delta,代码行数:24,代码来源:ContentBuilder.cs
示例17: OldOMBuildProject
private static ExitType OldOMBuildProject(ExitType exitType, string projectFile, string[] targets, string toolsVersion, Dictionary<string, string> globalProperties, ILogger[] loggers, LoggerVerbosity verbosity, bool needToValidateProject, string schemaFile, int cpuCount)
{
// Log something to avoid confusion caused by errant environment variable sending us down here
Console.WriteLine(AssemblyResources.GetString("Using35Engine"));
Microsoft.Build.BuildEngine.BuildPropertyGroup oldGlobalProps = new Microsoft.Build.BuildEngine.BuildPropertyGroup();
// Copy over the global properties to the old OM
foreach (KeyValuePair<string, string> globalProp in globalProperties)
{
oldGlobalProps.SetProperty(globalProp.Key, globalProp.Value);
}
if (!BuildProjectWithOldOM(projectFile, targets, toolsVersion, oldGlobalProps, loggers, verbosity, null, needToValidateProject, schemaFile, cpuCount))
{
exitType = ExitType.BuildError;
}
return exitType;
}
开发者ID:assafnativ,项目名称:msbuild,代码行数:18,代码来源:XMake.cs
示例18: catch
/// <summary>
/// Loads a logger from its assembly, instantiates it, and handles errors.
/// </summary>
/// <returns>Instantiated logger.</returns>
private static ILogger CreateAndConfigureLogger
(
LoggerDescription loggerDescription,
LoggerVerbosity verbosity,
string unquotedParameter
)
{
ILogger logger = null;
try
{
logger = loggerDescription.CreateLogger();
if (logger == null)
{
InitializationException.VerifyThrow(logger != null, "LoggerNotFoundError", unquotedParameter);
}
}
catch (IOException e)
{
InitializationException.Throw("LoggerCreationError", unquotedParameter, e, false);
}
catch (BadImageFormatException e)
{
InitializationException.Throw("LoggerCreationError", unquotedParameter, e, false);
}
catch (SecurityException e)
{
InitializationException.Throw("LoggerCreationError", unquotedParameter, e, false);
}
catch (ReflectionTypeLoadException e)
{
InitializationException.Throw("LoggerCreationError", unquotedParameter, e, false);
}
catch (MemberAccessException e)
{
InitializationException.Throw("LoggerCreationError", unquotedParameter, e, false);
}
catch (TargetInvocationException e)
{
InitializationException.Throw("LoggerFatalError", unquotedParameter, e.InnerException, true);
}
// Configure the logger by setting the verbosity level and parameters
try
{
// set its verbosity level
logger.Verbosity = verbosity;
// set the logger parameters (if any)
if (loggerDescription.LoggerSwitchParameters != null)
{
logger.Parameters = loggerDescription.LoggerSwitchParameters;
}
}
catch (LoggerException)
{
// Logger failed politely during parameter/verbosity setting
throw;
}
catch (Exception e)
{
InitializationException.Throw("LoggerFatalError", unquotedParameter, e, true);
}
return logger;
}
开发者ID:assafnativ,项目名称:msbuild,代码行数:72,代码来源:XMake.cs
示例19: ParseLoggingParameter
/// <summary>
/// Parse a command line logger argument into a LoggerDescription structure
/// </summary>
/// <param name="parameter">the command line string</param>
/// <returns></returns>
private static LoggerDescription ParseLoggingParameter(string parameter, string unquotedParameter, LoggerVerbosity verbosity)
{
ArrayList loggerSpec;
string loggerClassName;
string loggerAssemblyName;
string loggerAssemblyFile;
string loggerParameters = null;
int emptySplits; // ignored
// split each <logger type>;<logger parameters> string into two pieces, breaking on the first ; that is found
loggerSpec = QuotingUtilities.SplitUnquoted(parameter, 2, true /* keep empty splits */, false /* keep quotes */, out emptySplits, ';');
ErrorUtilities.VerifyThrow((loggerSpec.Count >= 1) && (loggerSpec.Count <= 2),
"SplitUnquoted() must return at least one string, and no more than two.");
// check that the logger is specified
CommandLineSwitchException.VerifyThrow(((string)loggerSpec[0]).Length > 0,
"InvalidLoggerError", unquotedParameter);
// extract logger parameters if present
if (loggerSpec.Count == 2)
{
loggerParameters = QuotingUtilities.Unquote((string)loggerSpec[1]);
}
// split each <logger class>,<logger assembly> string into two pieces, breaking on the first , that is found
ArrayList loggerTypeSpec = QuotingUtilities.SplitUnquoted((string)loggerSpec[0], 2, true /* keep empty splits */, false /* keep quotes */, out emptySplits, ',');
ErrorUtilities.VerifyThrow((loggerTypeSpec.Count >= 1) && (loggerTypeSpec.Count <= 2),
"SplitUnquoted() must return at least one string, and no more than two.");
string loggerAssemblySpec;
// if the logger class and assembly are both specified
if (loggerTypeSpec.Count == 2)
{
loggerClassName = QuotingUtilities.Unquote((string)loggerTypeSpec[0]);
loggerAssemblySpec = QuotingUtilities.Unquote((string)loggerTypeSpec[1]);
}
else
{
loggerClassName = String.Empty;
loggerAssemblySpec = QuotingUtilities.Unquote((string)loggerTypeSpec[0]);
}
CommandLineSwitchException.VerifyThrow(loggerAssemblySpec.Length > 0,
"InvalidLoggerError", unquotedParameter);
loggerAssemblyName = null;
loggerAssemblyFile = null;
// DDB Bug msbuild.exe -Logger:FileLogger,Microsoft.Build.Engine fails due to moved engine file.
// Only add strong naming if the assembly is a non-strong named 'Microsoft.Build.Engine' (i.e, no additional characteristics)
// Concat full Strong Assembly to match v4.0
if (String.Compare(loggerAssemblySpec, "Microsoft.Build.Engine", StringComparison.OrdinalIgnoreCase) == 0)
{
loggerAssemblySpec = "Microsoft.Build.Engine,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a";
}
// figure out whether the assembly's identity (strong/weak name), or its filename/path is provided
if (File.Exists(loggerAssemblySpec))
{
loggerAssemblyFile = loggerAssemblySpec;
}
else
{
loggerAssemblyName = loggerAssemblySpec;
}
return new LoggerDescription(loggerClassName, loggerAssemblyName, loggerAssemblyFile, loggerParameters, verbosity);
}
开发者ID:assafnativ,项目名称:msbuild,代码行数:78,代码来源:XMake.cs
示例20: ProcessDistributedLoggerSwitch
/// <summary>
/// Parses command line arguments describing the distributed loggers
/// </summary>
/// <returns>List of distributed logger records</returns>
private static List<DistributedLoggerRecord> ProcessDistributedLoggerSwitch(string[] parameters, LoggerVerbosity verbosity)
{
List<DistributedLoggerRecord> distributedLoggers = new List<DistributedLoggerRecord>();
foreach (string parameter in parameters)
{
// split each <central logger>|<node logger> string into two pieces, breaking on the first | that is found
int emptySplits; // ignored
ArrayList loggerSpec = QuotingUtilities.SplitUnquoted(parameter, 2, true /* keep empty splits */, false /* keep quotes */, out emptySplits, '*');
ErrorUtilities.VerifyThrow((loggerSpec.Count >= 1) && (loggerSpec.Count <= 2),
"SplitUnquoted() must return at least one string, and no more than two.");
string unquotedParameter = QuotingUtilities.Unquote((string)loggerSpec[0]);
LoggerDescription centralLoggerDescription =
ParseLoggingParameter((string)loggerSpec[0], unquotedParameter, verbosity);
ILogger centralLogger = CreateAndConfigureLogger(centralLoggerDescription, verbosity, unquotedParameter);
// By default if no forwarding logger description is specified the same logger is used for both functions
LoggerDescription forwardingLoggerDescription = centralLoggerDescription;
if (loggerSpec.Count > 1)
{
unquotedParameter = QuotingUtilities.Unquote((string)loggerSpec[1]);
forwardingLoggerDescription = ParseLoggingParameter((string)loggerSpec[1], unquotedParameter, verbosity);
}
DistributedLoggerRecord distributedLoggerRecord =
new DistributedLoggerRecord(centralLogger, forwardingLoggerDescription);
distributedLoggers.Add(distributedLoggerRecord);
}
return distributedLoggers;
}
开发者ID:assafnativ,项目名称:msbuild,代码行数:40,代码来源:XMake.cs
注:本文中的LoggerVerbosity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论