本文整理汇总了C#中LogData类的典型用法代码示例。如果您正苦于以下问题:C# LogData类的具体用法?C# LogData怎么用?C# LogData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogData类属于命名空间,在下文中一共展示了LogData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save_WriteBananaToFile_Test
public void Save_WriteBananaToFile_Test()
{
LogData logData = new LogData();
logData.Category = "Fruta";
logData.LogType = "Erro";
logData.ObjectToLog = "Banana";
logData.MethodName = "Save_WriteBanana_To_File";
ConfigurationUtilityMock mock = new ConfigurationUtilityMock();
mock.LogPath = "c:/BananaDePijama";
mock.LogType = "File";
IocFactory.Register(
Component.For<IConfigurationUtility>()
.Instance(mock),
Component.For<ILog>()
.ImplementedBy<FileLogProcessor>()
.Interceptor<LogInterceptor>()
);
ILog log = IocFactory.Resolve<ILog>();
log.Save(logData);
}
示例2: Write
/// <summary>
/// Called when any message is written to the log.
/// </summary>
/// <param name="log">The log.</param>
/// <param name="message">The message.</param>
/// <param name="logEvent">The log event.</param>
/// <param name="extraData">The additional data.</param>
/// <param name="logData">The log data.</param>
/// <param name="time">The time.</param>
protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, System.DateTime time)
{
base.Write(log, message, logEvent, extraData, time);
switch (logEvent)
{
case LogEvent.Debug:
_eventSource.Debug(message);
break;
case LogEvent.Info:
_eventSource.Info(message);
break;
case LogEvent.Warning:
_eventSource.Warning(message);
break;
case LogEvent.Error:
_eventSource.Error(message);
break;
default:
throw new ArgumentOutOfRangeException("logEvent");
}
}
示例3: Write
protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time)
{
if (log.TargetType != typeof(TestLogListener))
{
return;
}
switch (logEvent)
{
case LogEvent.Debug:
DebugCount++;
break;
case LogEvent.Info:
InfoCount++;
break;
case LogEvent.Warning:
WarningCount++;
break;
case LogEvent.Error:
ErrorCount++;
break;
case LogEvent.Status:
StatusCount++;
break;
}
}
示例4: Post
public void Post(LogData data)
{
data.User = GetCurrentSession().User;
var log = GetLog(data);
var @event = CreateEvent(data, log);
SaveMeasurements(data.User, log, @event, data.Measurements);
SaveTags(log, data.User, @event, data.Tags);
}
示例5: WriteLog
/// <summary>
/// Writes the specified LogData to NLog.
/// </summary>
/// <param name="logData">The log data.</param>
public static void WriteLog(LogData logData)
{
var logEvent = logData.ToLogEvent();
var name = logData.Logger ?? typeof(NLogWriter).FullName;
var logger = global::NLog.LogManager.GetLogger(name);
logger.Log(logEvent);
}
示例6: LogMessageEventArgs
/// <summary>
/// Initializes a new instance of the <see cref="LogMessageEventArgs" /> class.
/// </summary>
/// <param name="log">The log.</param>
/// <param name="message">The message.</param>
/// <param name="extraData">The extra data.</param>
/// <param name="logData">The log data.</param>
/// <param name="logEvent">The log event.</param>
/// <param name="time">The time.</param>
public LogMessageEventArgs(ILog log, string message, object extraData, LogData logData, LogEvent logEvent, DateTime time)
{
Log = log;
Time = time;
Message = message;
ExtraData = extraData;
LogEvent = logEvent;
LogData = logData;
}
示例7: Write
protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time)
{
_textBox.Dispatcher.Invoke(() =>
{
_textBox.AppendText(string.Format("{0} {1}", time.ToString("HH:mm:ss.fff"), message));
_textBox.AppendText(Environment.NewLine);
_textBox.ScrollToEnd();
});
}
示例8: ShouldIgnoreLogMessage
protected override bool ShouldIgnoreLogMessage(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time)
{
if (message.StartsWith("Uninitialized"))
{
return true;
}
return false;
}
示例9: GetLog
private Log GetLog(LogData data)
{
var log = LogRepository.Name(data.Name);
if (log == null)
{
log = new Log { Id = Guid.NewGuid(), Name = data.Name, UserId = data.User.Id };
LogRepository.Create(log);
}
return log;
}
示例10: Reverse
public Reverse(Stage stage, Game1 game, ContentManager content)
{
this.game = game;
this.stage = stage;
this.content = content;
nowlogdata = new LogData();
reverseLog = new List<LogData>();
score_prev = 0;
tasSound = content.Load<SoundEffect>("Audio\\SE\\TAS");
}
示例11: Save
public void Save(LogData logData)
{
EventLog log = new EventLog();
log.Source = "Troco$erto";
string logMessage = Serializer.JsonSerialize(logData.ObjectToLog);
log.WriteEntry(logMessage, EventLogEntryType.Information);
}
示例12: LogMessage
/// <summary>
/// メッセージを記録する
/// </summary>
/// <param name="message"></param>
public void LogMessage(string message)
{
if (_saveLog) {
LogData data = new LogData(LogData.LogType.Message, message);
Loglist.Add(data);
DebugWrite(message);
}
}
示例13: Log
public static void Log( LogData playClipData )
{
playClipData.time = Time.time;
if ( logData.Count >= 1024 )
{
logData.RemoveLast();
}
logData.AddFirst( playClipData );
_OnLogUpdated();
}
示例14: WriteLog
private static void WriteLog(LogData logData, Action<object> logAction, Action<object, Exception> errorAction)
{
bool isFormatted = logData.Parameters != null && logData.Parameters.Length > 0;
string message = isFormatted
? string.Format(logData.FormatProvider, logData.Message, logData.Parameters)
: logData.Message;
if (logData.Exception == null)
logAction(message);
else
errorAction(message, logData.Exception);
}
示例15: Write
/// <summary>
/// Called when any message is written to the log.
/// </summary>
/// <param name="log">The log.</param>
/// <param name="message">The message.</param>
/// <param name="logEvent">The log event.</param>
/// <param name="extraData">The additional data.</param>
/// <param name="logData">The log data.</param>
/// <param name="time">The time.</param>
protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time)
{
lock (_lock)
{
_logBatch.Add(new LogBatchEntry(log, message, logEvent, extraData, logData, time));
if (_logBatch.Count >= MaximumBatchCount)
{
// TODO: remove pragma in 5.0.0
#pragma warning disable 4014
Flush();
#pragma warning restore 4014
}
}
}