当前位置: 首页>>代码示例>>C#>>正文


C# LogMessageType类代码示例

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


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


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