本文整理汇总了C#中LogEntryType类的典型用法代码示例。如果您正苦于以下问题:C# LogEntryType类的具体用法?C# LogEntryType怎么用?C# LogEntryType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogEntryType类属于命名空间,在下文中一共展示了LogEntryType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogEntry
public LogEntry(DateTime logTime, string entryId, string message, LogEntryType type)
{
LogTime = logTime;
EntryId = entryId;
Message = message;
Type = type;
}
示例2: GetLogEntries
public static IEnumerable<LogEntry> GetLogEntries(LogEntryType filterLevel)
{
lock (LogEntryList)
{
return LogEntryList.Where(x => x.Type.CompareTo(filterLevel) >= 0).ToArray();
}
}
示例3: WriteLine
public void WriteLine(LogEntryType logEntryType, String message)
{
/* Timestamps are represented in the Round Trip Format Specifier
(http://msdn.microsoft.com/en-us/library/az4se3k1.aspx#Roundtrip). */
var timestamp = DateTime.Now.ToUniversalTime().ToString("o");
String type;
switch (logEntryType)
{
case LogEntryType.Info:
type = "INF";
break;
case LogEntryType.Warning:
type = "WRN";
break;
case LogEntryType.Error:
type = "ERR";
break;
default:
type = "UNK";
break;
}
this._writer.WriteLine(String.Format("{0} - {1} - {2}", timestamp, type, message));
}
示例4: LogEntry
/// <summary>
/// Initializes a new instance of LogEntry with username, message and log entry type.
/// </summary>
/// <param name="userName">Username who generated the log entry.</param>
/// <param name="message">Message associated with the log entry.</param>
/// <param name="entryType">Type of log entry.</param>
public LogEntry(string userName, string message, LogEntryType entryType)
{
this._TimwGenerated = DateTime.Now;
this._UserName = userName;
this._Message = message;
this._EntryType = entryType;
}
示例5: MonitorBinaryFileOutput
void IActivityMonitorBoundClient.SetMonitor( IActivityMonitorImpl source, bool forceBuggyRemove )
{
if( source != null && _source != null ) throw ActivityMonitorClient.CreateMultipleRegisterOnBoundClientException( this );
// Silently ignore null => null or monitor => same monitor.
if( source != _source )
{
_prevLogType = LogEntryType.None;
_prevlogTime = DateTimeStamp.Unknown;
Debug.Assert( (source == null) != (_source == null) );
if( (_source = source) == null )
{
if( _file != null ) _file.Close();
_file = null;
}
else
{
// If initialization failed, we let the file null: this monitor will not
// work (the error will appear in the Critical errors) but this avoids
// an exception to be thrown here.
var f = new MonitorBinaryFileOutput( _path, ((IUniqueId)_source).UniqueId, _maxCountPerFile, _useGzipCompression );
if( f.Initialize( new SystemActivityMonitor( false, null ) ) )
{
var g = _source.CurrentGroup;
_currentGroupDepth = g != null ? g.Depth : 0;
_file = f;
}
}
}
}
示例6: ActivityLogEntry
public ActivityLogEntry(string Message, long msTime)
{
m_Timestamp = DateTime.Now;
m_Type = LogEntryType.Timing;
m_Msg = Message;
m_Ref = msTime;
}
示例7: LogMessageToTextFile
private static int LogMessageToTextFile(LogEntryType type, string message)
{
try
{
string logmsg = "----------------------------\r\n" + //separator for new log
"Local time: " + DateTime.Now.ToString() + "\r\n" + //local time
//summary info
"Application Name: " + applicationName + "\r\n" +
"Log Type: " + type.ToString() + "\r\n" +
"Error Message:\r\n" + message + "\r\n";
//allow error log to be encoded by local time
string logFileName = string.Format(errorLogFileName, DateTime.Now);
using (StreamWriter w = File.AppendText(logFileName))
{
w.Write(logmsg);
}
return 0; //logged to local file
}
catch (Exception e)
{
//ignore errors, avoid infinite loop of trying to log errors
#if DEBUG
System.Console.WriteLine(e.ToString());
System.Diagnostics.Debug.WriteLine(e.ToString());
#endif
return -1;
}
}
示例8: Log
public static void Log(LogEntryType type, LogActionType action, string log, string metadata)
{
WriteLog($"LogEntryType: {type}\n" +
$"LogActionType : {action}\n" +
$"Log : {log}\n" +
$"Metadata : {metadata}");
}
示例9: LogEntry
public LogEntry(DateTime logTime, string id, string message, LogEntryType type)
{
LogTime = logTime;
Id = id;
Message = message;
Type = type;
}
示例10: LogEntry
internal LogEntry (LogEntryType type, string message, string details)
{
this.type = type;
this.message = message;
this.details = details;
this.timestamp = DateTime.Now;
}
示例11: LEMCLog
public LEMCLog( Guid monitorId, int depth, DateTimeStamp previousLogTime, LogEntryType previousEntryType, string text, DateTimeStamp t, string fileName, int lineNumber, LogLevel l, CKTrait tags, CKExceptionData ex )
: base( text, t, fileName, lineNumber, l, tags, ex )
{
_monitorId = monitorId;
_depth = depth;
_previousEntryType = previousEntryType;
_previousLogTime = previousLogTime;
}
示例12: LogEntry
public LogEntry(TimeSpan loggedTotalWorldTime, ILoggable loggable, LogEntryType entryType, TimeSpan logEntryLifetime)
{
_loggedTotalWorldTime = loggedTotalWorldTime;
_entryType = entryType;
_title = loggable.Title;
_details = loggable.Details.ToArray();
_fadeHelper = new TimedLerpHelper(loggedTotalWorldTime + logEntryLifetime - Constants.LogRenderer.FadeDuration, Constants.LogRenderer.FadeDuration, 1f, 0f);
}
示例13: Custom
public void Custom(LogEntryType type, string message, Exception exception = null)
{
lock (writeLock)
{
writer.WriteLine("{0}: {1}", type.ToString().ToUpper(), message);
WriteException(exception);
}
}
示例14: LEMCCloseGroup
public LEMCCloseGroup( Guid monitorId, int depth, DateTimeStamp previousLogTime, LogEntryType previousEntryType, DateTimeStamp t, LogLevel level, IReadOnlyList<ActivityLogGroupConclusion> c )
: base( t, level, c )
{
_monitorId = monitorId;
_depth = depth;
_previousEntryType = previousEntryType;
_previousLogTime = previousLogTime;
}
示例15: LogEntry
/// <summary>
/// Initializes a new instance of a log entry
/// </summary>
/// <param name="id">The unique id for this entry</param>
/// <param name="type">The log entry type</param>
/// <param name="message">The message to be logged</param>
/// <param name="logTime">The log time.</param>
/// <param name="exception">The exception information to be logged</param>
public LogEntry(int id, LogEntryType type, string message, DateTime logTime, Exception exception = null)
{
Id = id;
Type = type;
Message = message;
Exception = exception != null ? new ExceptionEntry(exception) : null;
LogTime = logTime;
}