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

C# LogMessageType类代码示例

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

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



LogMessageType类属于命名空间,在下文中一共展示了LogMessageType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AppendLog

        // Help methods that use our FileSystem abstraction
        public override void AppendLog(String message, LogMessageType messageType)
        {
            string textEntry = string.Format("{0:MM-dd-yyyy HH:mm:ss:ffff} :{1}: [{2}] {3}", DateTime.Now, System.Threading.Thread.CurrentThread.ManagedThreadId, messageType.ToString(), message);

            switch (messageType)
            {
                case LogMessageType.Info:
                    Android.Util.Log.Info(TAG, message);
                    break;
                case LogMessageType.Warn:
                    Android.Util.Log.Debug(TAG, message);
                    break;
                case LogMessageType.Debug:
                    Android.Util.Log.Debug(TAG, message);
                    break;
                case LogMessageType.Error:
                    Android.Util.Log.Error(TAG, message);
                    break;
                case LogMessageType.Fatal:
                    Android.Util.Log.Wtf(TAG, message);
                    break;
                case LogMessageType.Metric:
                    Android.Util.Log.Debug( TAG_METRIC, message );
                    break;
                default:
                    break;
            }

            AppendText(LogFileName, textEntry);
        }
开发者ID:BGCX262,项目名称:zulu-omoto-pos-client-svn-to-git,代码行数:31,代码来源:AndroidLogger.cs


示例2: Write

		/// <summary>
		/// Writes a single message to the output.
		/// </summary>
		/// <param name="source">The <see cref="Log"/> from which the message originates.</param>
		/// <param name="type">The type of the log message.</param>
		/// <param name="msg">The message to write.</param>
		/// <param name="context">The context in which this log was written. Usually the primary object the log entry is associated with.</param>
		public virtual void Write(Log source, LogMessageType type, string msg, object context)
		{
			int indent = source.Indent;
			string prefix = source.Prefix ?? "";
			string[] lines = msg.Split(new[] { '\n', '\r', '\0' }, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < lines.Length; i++)
			{
				if (i == 0)
				{
					switch (type)
					{
						case LogMessageType.Message:
							lines[i] = prefix + "Msg: " + new string(' ', indent * 2) + lines[i];
							break;
						case LogMessageType.Warning:
							lines[i] = prefix + "Wrn: " + new string(' ', indent * 2) + lines[i];
							break;
						case LogMessageType.Error:
							lines[i] = prefix + "ERR: " + new string(' ', indent * 2) + lines[i];
							break;
					}
				}
				else
				{
					lines[i] = new string(' ', prefix.Length + 5 + indent * 2) + lines[i];
				}

				this.WriteLine(source, type, lines[i], context);
			}
		}
开发者ID:Scottyaim,项目名称:duality,代码行数:37,代码来源:TextWriterLogOutput.cs


示例3: Write

        /// <summary>
        /// Writes a single message to the output.
        /// </summary>
        /// <param name="source">The <see cref="Log"/> from which the message originates.</param>
        /// <param name="type">The type of the log message.</param>
        /// <param name="msg">The message to write.</param>
        /// <param name="context">The context in which this log was written. Usually the primary object the log entry is associated with.</param>
        public virtual void Write(Log source, LogMessageType type, string msg, object context)
        {
            int indent = source.Indent;
            string[] lines = msg.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < lines.Length; i++)
            {
                if (i == 0)
                {
                    switch (type)
                    {
                        case LogMessageType.Message:
                            lines[i] = source.Prefix + "Info:    " + new string(' ', indent * 4) + lines[i];
                            break;
                        case LogMessageType.Warning:
                            lines[i] = source.Prefix + "Warning: " + new string(' ', indent * 4) + lines[i];
                            break;
                        case LogMessageType.Error:
                            lines[i] = source.Prefix + "ERROR:   " + new string(' ', indent * 4) + lines[i];
                            break;
                    }
                }
                else
                {
                    lines[i] = source.Prefix + "         " + new string(' ', indent * 4) + lines[i];
                }

                this.writer.WriteLine(lines[i]);
            }
        }
开发者ID:BraveSirAndrew,项目名称:duality,代码行数:36,代码来源:TextWriterLogOutput.cs


示例4: LogMessage

 public LogMessage(String message, LogMessageType type, LogMessageSeverity severity, Exception exception)
 {
     Message = message;
     Type = type;
     Severity = severity;
     Exception = exception;
 }
开发者ID:yuxin80,项目名称:QuantConnectDataConverter,代码行数:7,代码来源:LogMessage.cs


示例5: DoLog

 /// <summary>
 /// Write Log By MessageType
 /// </summary>
 /// <param name="message">Message</param>
 /// <param name="messageType">MessageType</param>
 /// <param name="ex">Exception Object</param>
 /// <param name="type">Log Source Type</param>
 private static void DoLog(string message, LogMessageType messageType, Exception ex, Type type)
 {
     string stackTrace = string.Empty;
     if (ex != null)
     {
         stackTrace = ex.StackTrace;
     }
     _mLog = LogManager.GetLogger(type);
     switch (messageType)
     {
         case LogMessageType.Debug:
             //AppLog._mLog.Debug(message + " ExceptionStackTrace:" + stackTrace, ex);//Edit by Gerry
             AppLog._mLog.Debug(message + stackTrace, ex);
             break;
         case LogMessageType.Info:
             AppLog._mLog.Info(message + stackTrace, ex);
             break;
         case LogMessageType.Warn:
             AppLog._mLog.Warn(message + stackTrace, ex);
             break;
         case LogMessageType.Error:
             AppLog._mLog.Error(message + stackTrace, ex);
             break;
         case LogMessageType.Fatal:
             AppLog._mLog.Fatal(message + stackTrace, ex);
             break;
     }
 }
开发者ID:MedicalProjectto,项目名称:medical_net,代码行数:35,代码来源:AppLog.cs


示例6: Colorize

		void Colorize ( LogMessageType eventType )
		{
			switch (eventType) {
				case LogMessageType.Debug :
					Console.ForegroundColor	=	ConsoleColor.DarkGreen;
					Console.BackgroundColor	=	ConsoleColor.Black;
				break;
				case LogMessageType.Verbose :
					Console.ForegroundColor	=	ConsoleColor.DarkGray;
					Console.BackgroundColor	=	ConsoleColor.Black;
				break;
				case LogMessageType.Information :
					Console.ForegroundColor	=	ConsoleColor.Gray;
					Console.BackgroundColor	=	ConsoleColor.Black;
				break;
				case LogMessageType.Warning :
					Console.ForegroundColor	=	ConsoleColor.Yellow;
					Console.BackgroundColor	=	ConsoleColor.Black;
				break;
				case LogMessageType.Error :
					Console.ForegroundColor	=	ConsoleColor.Red;
					Console.BackgroundColor	=	ConsoleColor.Black;
				break;
				case LogMessageType.Fatal :
					Console.ForegroundColor	=	ConsoleColor.Yellow;
					Console.BackgroundColor	=	ConsoleColor.Red;
				break;
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:29,代码来源:StdLogListener.cs


示例7: LogMessage

 public LogMessage(string text, DateTime timestamp, string sourceInfo, LogMessageType type)
 {
     this.text = text;
     this.timestamp = timestamp;
     this.sourceInfo = sourceInfo;
     this.type = type;
 }
开发者ID:NiklasVd,项目名称:Biocell,代码行数:7,代码来源:Debug.cs


示例8: LogMessage

 /// <summary>
 /// Initializes a new instance of the <see cref="LogMessage"/> class.
 /// </summary>
 /// <param name="content">
 /// The content.
 /// </param>
 /// <param name="messageType">
 /// The message type.
 /// </param>
 /// <param name="logLevel">
 /// The log level.
 /// </param>
 /// <param name="messageIndex">
 /// The message Index.
 /// </param>
 public LogMessage(string content, LogMessageType messageType, LogLevel logLevel, long messageIndex)
 {
     this.Content = content;
     this.MessageType = messageType;
     this.LogLevel = logLevel;
     this.MessageIndex = messageIndex;
 }
开发者ID:2wayne,项目名称:HandBrake,代码行数:22,代码来源:LogMessage.cs


示例9: WriteLineTest1

 public void WriteLineTest1()
 {
     LogMessageType messageFlag = new LogMessageType(); // TODO: 初始化为适当的值
     string strFormat = string.Empty; // TODO: 初始化为适当的值
     object[] arg = null; // TODO: 初始化为适当的值
     LOGs.WriteLine( messageFlag, strFormat, arg );
     Assert.Inconclusive( "无法验证不返回值的方法。" );
 }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:8,代码来源:LOGsTest.cs


示例10: GetWriter

		TextWriter GetWriter ( LogMessageType eventType )
		{
			if ( eventType==LogMessageType.Error || eventType==LogMessageType.Warning || eventType==LogMessageType.Fatal ) {
				return Console.Error;
			} else {
				return Console.Out;
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:8,代码来源:StdLogListener.cs


示例11: AssetLogMessage

 /// <summary>
 /// Initializes a new instance of the <see cref="AssetLogMessage" /> class.
 /// </summary>
 /// <param name="package">The package.</param>
 /// <param name="assetReference">The asset reference.</param>
 /// <param name="type">The type.</param>
 /// <param name="messageCode">The message code.</param>
 /// <param name="arguments">The arguments.</param>
 /// <exception cref="System.ArgumentNullException">asset</exception>
 public AssetLogMessage(Package package, IReference assetReference, LogMessageType type, string text)
 {
     this.package = package;
     AssetReference = assetReference;
     Type = type;
     Related = new List<IReference>();
     Text = text;
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:17,代码来源:AssetLogMessage.cs


示例12: WriteMessage

 public override void WriteMessage(string message, LogMessageType type, Exception exception)
 {
 	if (type == LogMessageType.Error)
 		System.Threading.Interlocked.Increment(ref ErrorCount);
 	else if (type == LogMessageType.Warning)
 		System.Threading.Interlocked.Increment(ref WarningCount);
     base.WriteMessage(this.Backupset + ", " + message, type, exception);
 }
开发者ID:Xelio,项目名称:duplicati,代码行数:8,代码来源:SVNCheckoutsTest.cs


示例13: AppendLog

        // Help methods that use our FileSystem abstraction
        public override void AppendLog(String message, LogMessageType messageType)
        {
            string textEntry = string.Format("{0:MM-dd-yyyy HH:mm:ss:ffff} :{1}: [{2}] {3}", DateTime.Now, System.Threading.Thread.CurrentThread.ManagedThreadId, messageType.ToString(), message);

            Console.WriteLine(textEntry);

            AppendText(LogFileName, textEntry);
        }
开发者ID:BGCX262,项目名称:zulu-omoto-pos-client-svn-to-git,代码行数:9,代码来源:BasicLogger.cs


示例14: LogMessage

 /// <summary>
 /// Initializes a new instance of the <see cref="LogMessage" /> class.
 /// </summary>
 /// <param name="module">The module.</param>
 /// <param name="type">The type.</param>
 /// <param name="text">The text.</param>
 /// <param name="exception">The exception.</param>
 /// <param name="callerInfo">The caller info.</param>
 public LogMessage(string module, LogMessageType type, string text, Exception exception, CallerInfo callerInfo)
 {
     Module = module;
     Type = type;
     Text = text;
     Exception = exception;
     CallerInfo = callerInfo;
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:16,代码来源:LogMessage.cs


示例15: ActivateLog

        /// <summary>
        /// Activates the log for loggers that match a regex pattern on the module name.
        /// </summary>
        /// <param name="regexPatternModule">The regex pattern to match a module name.</param>
        /// <param name="minimumLevel">The minimum level.</param>
        /// <param name="maximumLevel">The maximum level.</param>
        /// <param name="enabledFlag">if set to <c>true</c> enaable the log, else disable.</param>
        /// <exception cref="ArgumentNullException">If regexPatternModule is null</exception>
        public static void ActivateLog(string regexPatternModule, LogMessageType minimumLevel, LogMessageType maximumLevel = LogMessageType.Fatal, bool enabledFlag = true)
        {
            if (regexPatternModule == null)
                throw new ArgumentNullException("regexPatternModule");

            var regex = new Regex(regexPatternModule);
            ActivateLog(regex, minimumLevel, maximumLevel);
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:16,代码来源:GlobalLogger.cs


示例16: LogInfo

 /// <summary>
 /// 
 /// </summary>
 /// <param name="messageFlag"></param>
 /// <param name="strFormat"></param>
 /// <param name="parameter"></param>
 public LogInfo(LogMessageType messageFlag, string strFormat, object[] parameter = null)
 {
     m_messageFlag = messageFlag;
     format = strFormat;
     _parameter = parameter;
     outStr = null;
     time = DateTime.Now;
 }
开发者ID:RainsSoft,项目名称:NetWorkClient,代码行数:14,代码来源:LogInfo.cs


示例17: LogMessageEventArgs

        public LogMessageEventArgs(LogMessageType logMessageType, string message)
        {
            if (message == null)
                throw new ArgumentNullException("message");

            LogMessageType = logMessageType;
            Message = message;
        }
开发者ID:kevinswarner,项目名称:Hover_OLD,代码行数:8,代码来源:LogMessageEventArgs.cs


示例18: SerializableLogMessage

 /// <summary>
 /// Initializes a new instance of the <see cref="SerializableLogMessage"/> class using the given parameters to set its properties.
 /// </summary>
 /// <param name="module">The module name.</param>
 /// <param name="type">The type.</param>
 /// <param name="text">The text.</param>
 /// <param name="exceptionInfo">The exception information. This parameter can be null.</param>
 public SerializableLogMessage(string module, LogMessageType type, string text, ExceptionInfo exceptionInfo = null)
 {
     if (module == null) throw new ArgumentNullException("module");
     if (text == null) throw new ArgumentNullException("text");
     Module = module;
     Type = type;
     Text = text;
     ExceptionInfo = exceptionInfo;
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:16,代码来源:SerializableLogMessage.cs


示例19: WriteMessage

 /// <summary>
 /// The function called when a message is logged
 /// </summary>
 /// <param name="message">The message logged</param>
 /// <param name="type">The type of message logged</param>
 /// <param name="exception">An exception, may be null</param>
 public virtual void WriteMessage(string message, LogMessageType type, Exception exception)
 {
     m_stream.WriteLine("{0:u} - {1}: {2}", DateTime.Now, type, message);
     if (exception != null)
     {
         m_stream.WriteLine(exception.ToString());
         m_stream.WriteLine();
     }
 }
开发者ID:admz,项目名称:duplicati,代码行数:15,代码来源:StreamLog.cs


示例20: LogEntry

			public LogEntry(Log source, LogMessageType type, string msg)
			{
				this.source = source;
				this.type = type;
				this.msg = msg;
				this.indent = source.Indent;
				this.timestamp = DateTime.Now;
				this.frameIndex = Time.FrameCount;
			}
开发者ID:Andrea,项目名称:duality-withsvn-history,代码行数:9,代码来源:DataLogOutput.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# LogOnModel类代码示例发布时间:2022-05-24
下一篇:
C# LogMessage类代码示例发布时间: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