Example #1
0
    /// <summary>
    /// Function responsible for writing to the debug log
    /// </summary>
    /// <param name="eLevel">Debug level of this message, from enum EDebugLevel
    /// <param name="cMessage">The message to write
    public static void WriteToLog(EDebugLevel eLevel, object cMessage)
    {
#if DEBUG_LEVEL_WARN
        if ((eLevel & EDebugLevel.DEBUG_WARN) != 0)
        {
            Debug.Log(WARN_MESSAGE + cMessage);
        }
#endif //DEBUG_LEVEL_WARN

#if DEBUG_LEVEL_ERROR
        if ((eLevel & EDebugLevel.DEBUG_ERROR) != 0)
        {
            Debug.Log(ERROR_MESSAGE + cMessage);
        }
#endif //DEBUG_LEVEL_ERROR

#if DEBUG_LEVEL_CRITICAL
        if ((eLevel & EDebugLevel.DEBUG_CRITICAL) != 0)
        {
            Debug.Log(CRITICAL_MESSAGE + cMessage);
        }
#endif //DEBUG_LEVEL_CRITICAL

#if DEBUG_LEVEL_INFO
        if ((eLevel & EDebugLevel.DEBUG_INFO) != 0)
        {
            Debug.Log(INFO_MESSAGE + cMessage);
        }
#endif //DEBUG_LEVEL_INFO
    }
Example #2
0
 // Constructor, default values
 private LogFile()
 {
     m_uDebugFilter = DT_NONE;
     m_edlDebugLevel = EDebugLevel.None;
     m_sw = null;
     m_fs = null;
     m_asLatestLines = new string[LINE_BUFSIZE]; // TODO: Check all entries initialise
     m_nLatestLineIndex = 0;
 }
Example #3
0
    /// <summary>
    /// Function responsible for writing to the debug log.
    /// </summary>
    /// <param name="debugLevel"> Debug level of this message, from enum EDebugLevel.</param>
    /// <param name="incomingMessage"> The message to write.</param>
    public void WriteToLog(EDebugLevel debugLevel, object incomingMessage)
    {
#if DEBUG_LEVEL_WARN
        if ((debugLevel & EDebugLevel.DEBUG_WARN) != 0)
        {
            Debug.Log(WARN_MESSAGE + incomingMessage);
            LogDescriptor newException = new LogDescriptor(WARN_MESSAGE + incomingMessage);
            if (m_currentLogs != null)
            {
                m_currentLogs.Add(newException);
            }
        }
#endif //DEBUG_LEVEL_WARN

#if DEBUG_LEVEL_ERROR
        if ((debugLevel & EDebugLevel.DEBUG_ERROR) != 0)
        {
            Debug.Log(ERROR_MESSAGE + incomingMessage);
            LogDescriptor newException = new LogDescriptor(ERROR_MESSAGE + incomingMessage);
            if (m_currentLogs != null)
            {
                m_currentLogs.Add(newException);
            }
        }
#endif //DEBUG_LEVEL_ERROR

#if DEBUG_LEVEL_CRITICAL
        if ((debugLevel & EDebugLevel.DEBUG_CRITICAL) != 0)
        {
            Debug.Log(CRITICAL_MESSAGE + incomingMessage);
            LogDescriptor newException = new LogDescriptor(CRITICAL_MESSAGE + incomingMessage);
            if (m_currentLogs != null)
            {
                m_currentLogs.Add(newException);
            }
        }
#endif //DEBUG_LEVEL_CRITICAL

#if DEBUG_LEVEL_INFO
        if ((debugLevel & EDebugLevel.DEBUG_INFO) != 0)
        {
            Debug.Log(INFO_MESSAGE + incomingMessage);
            LogDescriptor newException = new LogDescriptor(INFO_MESSAGE + incomingMessage);
            if (m_currentLogs != null)
            {
                m_currentLogs.Add(newException);
            }
        }
#endif //DEBUG_LEVEL_INFO
    }
Example #4
0
 public IGenerator SetDebugLEvel(EDebugLevel level)
 {
     return(Do(() => { Kernel.DebugLevel = level; }));
 }
Example #5
0
 public IGenerator SetDebugLevel(EDebugLevel level)
 => Do(() => { Kernel.DebugLevel = level; });
Example #6
0
    /// <summary>
    /// Function responsible for writing to the debug log.
    /// </summary>
    /// <param name="debugLevel"> Debug level of this message, from enum EDebugLevel.</param>
    /// <param name="incomingMessage"> The message to write.</param>
    public void WriteToLog(EDebugLevel debugLevel, object incomingMessage)
    {
#if DEBUG_LEVEL_WARN
        if ((debugLevel & EDebugLevel.DEBUG_WARN) != 0)
        {
            Debug.Log(WARN_MESSAGE + incomingMessage);
            LogDescriptor newException = new LogDescriptor(WARN_MESSAGE + incomingMessage);
            if (m_currentLogs != null)
            {
                m_currentLogs.Add(newException);
            }
        }
#endif //DEBUG_LEVEL_WARN

#if DEBUG_LEVEL_ERROR
        if ((debugLevel & EDebugLevel.DEBUG_ERROR) != 0)
        {
            Debug.Log(ERROR_MESSAGE + incomingMessage);
            LogDescriptor newException = new LogDescriptor(ERROR_MESSAGE + incomingMessage);
            if (m_currentLogs != null)
            {
                m_currentLogs.Add(newException);
            }
        }
#endif //DEBUG_LEVEL_ERROR

#if DEBUG_LEVEL_CRITICAL
        if ((debugLevel & EDebugLevel.DEBUG_CRITICAL) != 0)
        {
            Debug.Log(CRITICAL_MESSAGE + incomingMessage);
            LogDescriptor newException = new LogDescriptor(CRITICAL_MESSAGE + incomingMessage);
            if (m_currentLogs != null)
            {
                m_currentLogs.Add(newException);
            }
        }
#endif //DEBUG_LEVEL_CRITICAL

#if DEBUG_LEVEL_INFO
        if ((debugLevel & EDebugLevel.DEBUG_INFO) != 0)
        {
            Debug.Log(INFO_MESSAGE + incomingMessage);
            LogDescriptor newException = new LogDescriptor(INFO_MESSAGE + incomingMessage);
            if (m_currentLogs != null)
            {
                m_currentLogs.Add(newException);
            }
        }
#endif //DEBUG_LEVEL_INFO
    }
Example #7
0
 // Writes a line to the log file, but not to the log buffer that gets printed by the exception handler
 public void WriteLine( uint t, EDebugLevel d, string s, bool b_exclude_from_exception_message )
 {
     if( b_exclude_from_exception_message == false )
     {
         m_asLatestLines[ m_nLatestLineIndex ] = s;
         m_nLatestLineIndex++;
         if( m_nLatestLineIndex == LINE_BUFSIZE )
         {
             m_nLatestLineIndex = 0;
         }
     }
     try
     {
         if( (t & m_uDebugFilter) != 0 )
         {
             if( d >= m_edlDebugLevel )
             {
                 if( m_sw != null )
                 {
                     m_sw.WriteLine( s );
                 }
                 System.Diagnostics.Trace.WriteLine( System.DateTime.Now.ToFileTime() + " " + s );
             }
         }
     }
     catch( Exception e )
     {
         System.Diagnostics.Trace.WriteLine( e.Message );
     }
 }
Example #8
0
 // Writes a line to the log file
 public void WriteLine( uint t, EDebugLevel d, string s )
 {
     WriteLine( t, d, s, false );
 }
Example #9
0
 // Sets level of verbosity
 public void SetLogLevel( EDebugLevel d )
 {
     m_edlDebugLevel = d;
 }