本文整理汇总了C#中Severity类的典型用法代码示例。如果您正苦于以下问题:C# Severity类的具体用法?C# Severity怎么用?C# Severity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Severity类属于命名空间,在下文中一共展示了Severity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CalculatesPriorityValueCorrectly
public void CalculatesPriorityValueCorrectly(Facility facility, Severity severity, int expectedPriorityValue)
{
var msg = CreateMinimalSyslogMessage(facility, severity);
string serializedMsg = sut.Serialize(msg);
Assert.Equal(String.Format("<{0}>1 - - - - -", expectedPriorityValue), serializedMsg);
}
开发者ID:johnulist,项目名称:SyslogNet,代码行数:7,代码来源:SyslogRfc5424MessageSerializerTests.cs
示例2: FormatError
public FormatError(byte[] buffer, int ptr, Severity sev, string msg)
{
_buf = buffer;
_offset = ptr;
_severity = sev;
_message = msg;
}
开发者ID:dev218,项目名称:GitSharp,代码行数:7,代码来源:FormatError.cs
示例3: LoggerMessage
public LoggerMessage(Severity severity, int threadId, string threadName, string message)
{
Severity = severity;
ThreadId = threadId;
ThreadName = threadName;
Message = message;
}
开发者ID:iLuffy,项目名称:ILuffy,代码行数:7,代码来源:LoggerMessage.cs
示例4: PreProcess
private static void PreProcess(Severity severity, string additionalMessage, Exception exception)
{
var callStack = new StackTrace(1, true);
var stackFrame = callStack.GetFrame(1);
var log = new Log
{
MethodName = stackFrame.GetMethod().Name,
ClassName = stackFrame.GetMethod().DeclaringType.Name,
ApplicationName = stackFrame.GetMethod().DeclaringType.Assembly.GetName().Name,
LineNumber = stackFrame.GetFileLineNumber(),
Severity = (int)severity,
Message = $"Message: {additionalMessage ?? ""}"
};
if (exception.IsNotNull())
{
log.Message += $" Exception: {(exception.IsNotNull() ? exception.ToString() : "")}";
}
using (var ctx = new ApplicationDbContext())
{
ctx.Logs.Add(log);
ctx.SaveChanges();
}
}
开发者ID:DevJonny,项目名称:Russ,代码行数:25,代码来源:Logger.cs
示例5: TrackTrace
public void TrackTrace(string message, Severity severity, IDictionary<string, string> properties)
{
LogEventLevel level = LogEventLevel.Verbose;
switch (severity)
{
case Severity.Off:
return;
case Severity.Error:
level = LogEventLevel.Error;
break;
case Severity.Warning:
level = LogEventLevel.Warning;
break;
case Severity.Verbose:
case Severity.Verbose2:
case Severity.Verbose3:
level = LogEventLevel.Verbose;
break;
}
if (_client.IsEnabled(level))
{
var logProperties = new List<LogEventProperty>();
if (properties != null)
logProperties.AddRange(properties.Select(x => new LogEventProperty(x.Key, new ScalarValue(x.Value))));
_client.Write(new LogEvent(DateTimeOffset.UtcNow, level, null,
new MessageTemplate("{message}", new []{new TextToken(message)}), logProperties));
}
}
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:30,代码来源:SerilogTelemetryConsumer.cs
示例6: RuleAttribute
public RuleAttribute(string key, Severity severity, string title, bool isActivatedByDefault)
{
Key = key;
Title = title;
Severity = severity;
IsActivatedByDefault = isActivatedByDefault;
}
开发者ID:ozgurkayaist,项目名称:sonarlint-vs,代码行数:7,代码来源:RuleAttribute.cs
示例7: Log
private static void Log(Severity severity, string message)
{
if (_logAction != null)
_logAction(severity, message);
else
Console.WriteLine($"{severity}: {message}");
}
开发者ID:t-denis,项目名称:CiscoWLC.WebAuth.Client,代码行数:7,代码来源:Logger.cs
示例8: Add
public override void Add(SourceUnit sourceUnit, string message, SourceSpan span, int errorCode, Severity severity)
{
base.Add(sourceUnit, message, span, errorCode, severity);
Console.Error.WriteLine("{0}({1}:{2}): {3}: RB{4}: {5}", sourceUnit.Name, span.Start.Line, span.Start.Column,
severity, errorCode, message);
}
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:Program.cs
示例9: AiReportOneObject
public AiReportOneObject(HitObjectBase h, BeenCorrectedDelegate corrected, Severity severity, string information, int weblink, GameMode Mode = GameMode.All)
: base(h.StartTime, severity, information, weblink, corrected, Mode)
{
this.h1 = h;
RelatedHitObjects.Add(h);
}
开发者ID:Ephemeralis,项目名称:osu-sdk,代码行数:7,代码来源:AiReportOneObject.cs
示例10: Log
private static void Log(string str, Severity sev)
{
string header = string.Empty;
switch (sev)
{
case Severity.TRACE:
header = "TT ##";
break;
case Severity.INFO:
header = "II ##";
break;
case Severity.WARNING:
header = "WW ##";
break;
case Severity.ERROR:
header = "EE ##";
break;
case Severity.STEPIN:
header = ">> ##";
break;
case Severity.STEPOUT:
header = "<< ##";
break;
}
Reporter.Log(header + str + Environment.NewLine);
}
开发者ID:ZeroTull,项目名称:MRA_Automation,代码行数:27,代码来源:Logger.cs
示例11: Filtered
public static IStatusAppender Filtered(IStatusAppender baseAppender, Severity[] severities)
{
if (severities == null) { throw new ArgumentNullException("severities"); } // $NON-NLS-1
if (baseAppender == null || object.ReferenceEquals(baseAppender, StatusAppender.Null)) {
return StatusAppender.Null;
} else if (severities.Length == 0) {
return StatusAppender.Null;
} else {
// 2^0 = 1 (None)
// 2^1 = 2 (Error)
// 2^2 = 4 (Warning)
// 2^3 = 8 (Information)
int result = 0;
for (int i = 0; i < severities.Length; i++) {
result &= (int) (Math.Pow(2, (int) severities[i]));
if (result >= 2 + 4 + 8) { // all have been set or more
return baseAppender;
}
}
bool appendInfos = (result & 8) > 0;
bool appendWarnings = (result & 4) > 0;
bool appendErrors = (result & 2) > 0;
return new FilteredStatusAppender(baseAppender, appendErrors, appendWarnings, appendInfos);
}
}
开发者ID:Carbonfrost,项目名称:ff-foundations-runtime,代码行数:30,代码来源:StatusAppender.Static.cs
示例12: Item
protected Item( Severity severity, string message,
object targetItem )
{
this.severity = severity;
this.message = message ?? string.Empty;
this.targetItem = targetItem;
}
开发者ID:pdjonov,项目名称:x42view,代码行数:7,代码来源:AuditItem.cs
示例13: Log
/// <summary>
/// Log a message. The current logging level is used to determine
/// if the message is appended to the configured appender
/// or if it is ignored.
/// </summary>
/// <param name="category">The category to which this log statement belongs.</param>
/// <param name="s">The severity of the logging message.</param>
/// <param name="errorMsg">A concise description of the problem encountered.</param>
/// <param name="args">Variable values that are to be captured with the logging statement.</param>
public static void Log(Severity s, string errorMsg, params object[] args)
{
if (args != null && args.Length > 0)
LogMessage(s, Format(s.ToString() + ": " + errorMsg, args), null);
else
LogMessage(s, errorMsg, null);
}
开发者ID:dzhendong,项目名称:Zero,代码行数:16,代码来源:ZeroLog.cs
示例14: ParseIssues
private List<ValidationIssue> ParseIssues(XContainer document, string rootName, string listName, string tagName, Severity severity)
{
var elements = from e in document.Descendants(_namespace + rootName) select e;
var issues = new List<ValidationIssue>();
foreach (var element in elements)
{
foreach (var list in element.Descendants(_namespace + listName))
{
foreach (var errorElement in list.Descendants(_namespace + tagName))
{
var issue = new ValidationIssue { Severity = severity };
if (errorElement.Descendants(_namespace + "line").Any())
issue.Row = int.Parse(errorElement.Descendants(_namespace + "line").First().Value);
if (errorElement.Descendants(_namespace + "col").Any())
issue.Column = int.Parse(errorElement.Descendants(_namespace + "col").First().Value);
if (errorElement.Descendants(_namespace + "message").Any())
{
issue.Title = errorElement.Descendants(_namespace + "message").First().Value;
issue.MessageId = Encoding.UTF8.GetString(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(issue.Title)));
}
issues.Add(issue);
}
}
}
return issues;
}
开发者ID:HippoValidator,项目名称:W3CCssValidationClient,代码行数:30,代码来源:W3CCssValidator.cs
示例15: LogMessage
public LogMessage(string message, IContext context, Severity severity)
{
Message = message;
Severity = severity;
Context = context;
Time = DateTime.Now;
}
开发者ID:TomPeters,项目名称:chooie,代码行数:7,代码来源:LogMessage.cs
示例16: Emit
private static void Emit(Severity s, string format, params object[] args)
{
lock (_consolelock)
{
var color = Console.ForegroundColor;
switch (s)
{
case Severity.information:
// Console.ForegroundColor = ConsoleColor.White;
break;
case Severity.warning:
Console.ForegroundColor = ConsoleColor.Yellow;
break;
case Severity.error:
Console.ForegroundColor = ConsoleColor.Red;
break;
}
var msg = string.Format(format, args);
if (Debugger.IsAttached)
{
Debug.WriteLine(msg);
}
Console.WriteLine(msg);
Console.ForegroundColor = color;
}
}
开发者ID:thomas13335,项目名称:wpf2html5,代码行数:31,代码来源:Log.cs
示例17: LogEntry
public LogEntry(string message, Type sourceOfLogMessage, DateTime timestamp, Severity severity)
{
Message = message;
SourceOfLogMessage = sourceOfLogMessage;
Timestamp = timestamp;
Severity = severity;
}
开发者ID:eaardal,项目名称:delbert,代码行数:7,代码来源:LogEntry.cs
示例18: Write
public void Write(Severity sev, string msg)
{
if (_isOpen == false)
{
return;
}
StringBuilder sb = new StringBuilder();
sb.Append("[");
if (sev == Severity.Debug)
{
sb.Append("D");
}
else if (sev == Severity.Warning)
{
sb.Append("W");
}
else if (sev == Severity.Error)
{
sb.Append("E");
}
sb.Append("]");
sb.Append("[");
sb.Append(DateTime.Now.ToString("dd/MM/yy HH:mm:ss"));
sb.Append("] ");
sb.Append(msg);
string line = sb.ToString ();
_logStream.WriteLine (line);
#if DEBUG
Console.WriteLine (line);
#endif
}
开发者ID:GusBricker,项目名称:cPanelSharp,代码行数:35,代码来源:Logger.cs
示例19: FormatError
public FormatError(byte[] buffer, int ptr, Severity sev, String msg)
{
buf = buffer;
offset = ptr;
severity = sev;
message = msg;
}
开发者ID:stephensong,项目名称:GitSharp,代码行数:7,代码来源:FormatError.cs
示例20: TrackTrace
public void TrackTrace(string message, Severity severity)
{
switch (severity)
{
case Severity.Error:
ConsoleText.WriteError(message);
break;
case Severity.Info:
ConsoleText.WriteStatus(message);
break;
case Severity.Verbose:
case Severity.Verbose2:
case Severity.Verbose3:
ConsoleText.WriteUsage(message);
break;
case Severity.Warning:
ConsoleText.WriteWarning(message);
break;
case Severity.Off:
return;
default:
TrackTrace(message);
break;
}
}
开发者ID:sbambach,项目名称:orleans,代码行数:25,代码来源:ConsoleTelemetryConsumer.cs
注:本文中的Severity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论