• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# LogData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



LogData类属于命名空间,在下文中一共展示了LogData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
        }
开发者ID:eduardojonssen,项目名称:TrocoSerto,代码行数:25,代码来源:FileLogProcessorTest.cs


示例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");
            }
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:35,代码来源:EtwLogListener.cs


示例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;
                }
            }
开发者ID:Catel,项目名称:Catel,代码行数:30,代码来源:LogManagerTest.cs


示例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);
 }
开发者ID:chrisharrington,项目名称:LogWhatever,代码行数:8,代码来源:LogsController.cs


示例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);
        }
开发者ID:modulexcite,项目名称:KickStart,代码行数:12,代码来源:NLogWriter.cs


示例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;
 }
开发者ID:Catel,项目名称:Catel,代码行数:18,代码来源:LogMessageEventArgs.cs


示例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();
     });
 }
开发者ID:WildGums,项目名称:Orc.Wizard,代码行数:9,代码来源:TextBoxLogListener.cs


示例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;
        }
开发者ID:sk8tz,项目名称:Orc.Controls,代码行数:9,代码来源:ExampleLogListener.cs


示例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;
 }
开发者ID:chrisharrington,项目名称:LogWhatever,代码行数:10,代码来源:LogsController.cs


示例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");
 }
开发者ID:pentiumx,项目名称:Tasrush-2DActionGame,代码行数:10,代码来源:Reverse.cs


示例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);
        }
开发者ID:eduardojonssen,项目名称:TrocoSerto,代码行数:10,代码来源:SystemLogProcessor.cs


示例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);

			}

		}
开发者ID:nico-lab,项目名称:niconama-ocv,代码行数:15,代码来源:Logger.cs


示例13: Log

    public static void Log( LogData playClipData )
    {
        playClipData.time = Time.time;

        if ( logData.Count >= 1024 )
        {
            logData.RemoveLast();
        }

        logData.AddFirst( playClipData );

        _OnLogUpdated();

    }
开发者ID:timmypowergamer,项目名称:RitualShooter,代码行数:14,代码来源:AudioLog.cs


示例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);
        }
开发者ID:modulexcite,项目名称:KickStart,代码行数:14,代码来源:Log4NetWriter.cs


示例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
                }
            }
        }
开发者ID:rishabh8,项目名称:Catel,代码行数:24,代码来源:BatchLogListenerBase.cs


示例16: Write

        protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time)
        {
            _textBox.Dispatcher.Invoke(() =>
            {
                var finalMessage = string.Format("{0} {1}", time.ToString("hh:mm:ss.fff"), message);

                var paragraph = new Paragraph(new Run(finalMessage));

                FixParagraphSpacing(paragraph);

                paragraph.Foreground = ColorSets[logEvent];
                _textBox.Document.Blocks.Add(paragraph);
                _textBox.ScrollToEnd();
            });
        }
开发者ID:bulanh,项目名称:Orchestra,代码行数:15,代码来源:RichTextBoxLogListener.cs


示例17: LogDump

		public LogDump(LogData data)
		{
			if (data != null)
			{
				this.StationName = data.SolutionName;
				this.NumberOfBuildsFailed = data.NumberOfBuildsFailed;
				this.NumberOfBuildsSucceeded = data.NumberOfBuildsSucceeded;
				this.NumberOfProjectsBuilt = data.NumberOfProjectsBuilt;
				this.NumberOfTestsFailed = data.NumberOfTestsFailed;
				this.NumberOfTestsIgnored = data.NumberOfTestsIgnored;
				this.NumberOfTestsPassed = data.NumberOfTestsPassed;
				this.NumberOfTestsRan = data.NumberOfTestsRan;
				this.StationName = data.StationName;
				this.TimeStamp = data.TimeStamp;
				this.UserName = data.UserName;
			}
		}
开发者ID:Vernathic,项目名称:ic-AutoTest.NET4CTDD,代码行数:17,代码来源:LogDump.cs


示例18: 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 extra 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)
        {
            base.Write(log, message, logEvent, extraData, time);

            var logEntry = new LogEntry(log, message, logEvent, extraData, null, time);

            AddLogEvent(_lastLogEntries, logEntry, MaximumNumberOfLogEntries);

            switch (logEvent)
            {
                case LogEvent.Warning:
                    AddLogEvent(_lastWarningLogEntries, logEntry, MaximumNumberOfWarningLogEntries);
                    break;

                case LogEvent.Error:
                    AddLogEvent(_lastErrorLogEntries, logEntry, MaximumNumberOfErrorLogEntries);
                    break;
            }
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:28,代码来源:RollingInMemoryLogListener.cs


示例19: Write

 protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time)
 {
     if (string.Equals(log.Tag, "Orc.CommandLine.CommandLineParser"))
     {
         return;
     }
     if (logEvent == LogEvent.Error)
     {
         Console.ForegroundColor = ConsoleColor.Red;
     }
     else if (logEvent == LogEvent.Warning)
     {
         Console.ForegroundColor = ConsoleColor.Yellow;
     }
     else
     {
         Console.ForegroundColor = ConsoleColor.White;
     }
     Console.WriteLine("{0}", message);
 }
开发者ID:WildGums,项目名称:Orc.DbToCsv,代码行数:20,代码来源:BriefConsoleLogger.cs


示例20: 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)
        {
            string consoleMessage = FormatLogEvent(log, message, logEvent, extraData, time);

#if NET
            var oldConsoleBackgroundColor = Console.BackgroundColor;
            var oldConsoleForegroundColor = Console.ForegroundColor;

            UpdateConsoleColors(logEvent);
#endif

#if NETFX_CORE || PCL
            System.Diagnostics.Debug.WriteLine(consoleMessage);
#else
            Console.WriteLine(consoleMessage);
#endif

#if NET
            Console.BackgroundColor = oldConsoleBackgroundColor;
            Console.ForegroundColor = oldConsoleForegroundColor;
#endif
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:31,代码来源:ConsoleLogListener.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LogDelegate类代码示例发布时间:2022-05-24
下一篇:
C# LogCategory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap