Axiom.Core.Log.Write C# (CSharp) Method

Write() public method

Write a message to the log.
public Write ( LogMessageLevel level, bool maskDebug, string message ) : void
level LogMessageLevel Importance of this logged message.
maskDebug bool If true, debug output will not be written.
message string Message to write, which can include string formatting tokens.
return void
		public void Write( LogMessageLevel level, bool maskDebug, string message, params object[] substitutions )
		{
			if ( _isDisposed )
				return;

			if ( message == null )
				throw new ArgumentNullException( "The log message cannot be null" );
			if ( ( (int)logLevel + (int)level ) > LogThreshold )
				return;	//too verbose a message to write

			// construct the log message
			if ( substitutions != null && substitutions.Length > 0 )
			{
				message = string.Format( message, substitutions );
			}

			// write the the debug output if requested
			if ( debugOutput && !maskDebug )
			{
				System.Diagnostics.Debug.WriteLine( message );
			}

			if ( writer != null && writer.BaseStream != null )
			{

				// prepend the current time to the message
				message = string.Format( "[{0}] {1}", DateTime.Now.ToString( "hh:mm:ss" ), message );

				// write the message and flush the buffer
				writer.WriteLine( message );
				//writer auto-flushes
			}

			FireMessageLogged( level, maskDebug, message );
		}

Same methods

Log::Write ( bool maskDebug, string message ) : void
Log::Write ( string message ) : void

Usage Example

Beispiel #1
0
        public static void Log(Log log)
        {
            log.Write("CPU Identifier & Features");
            log.Write("-------------------------");
            log.Write(cpuIdentifier);

            log.Write(" *     SSE1: {0}", IsSupported(CPUFeature.SSE1));
            log.Write(" *     SSE2: {0}", IsSupported(CPUFeature.SSE2));
            log.Write(" *     SSE3: {0}", IsSupported(CPUFeature.SSE3));
            log.Write(" *    SSSE3: {0}", IsSupported(CPUFeature.SSE41));
            log.Write(" *    SSSE3: {0}", IsSupported(CPUFeature.SSE42));
            log.Write(" *    SSSE3: {0}", IsSupported(CPUFeature.SSE4A));
            log.Write(" *    SSSE3: {0}", IsSupported(CPUFeature.SSSE3));
            log.Write("-------------------------");
        }