コード例 #1
0
ファイル: Logging.cs プロジェクト: Hydroxa/NanaManager
 /// <summary>
 /// Writes a message to the logs from the specified location at the specified severity level, prefixing with the supplied LogCode
 /// </summary>
 /// <param name="Message">The message to display</param>
 /// <param name="Location">The location the message came from</param>
 /// <param name="Level">The severity of the message</param>
 /// <param name="LogCode">The code of the message. Used for watching for specific logs</param>
 public static void Write(string Message, string Location, LogLevel Level, int LogCode)
 {
     try {
         write(string.Format(NUM_FORMAT, Message, Location, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond, Enum.GetName(typeof(LogLevel), Level), Convert.ToString(LogCode, 16)));
         NewMessageAdvanced?.Invoke(Message, Location, Level, DateTime.Now, null, LogCode);
     } catch (InvalidOperationException) {
         throw;
     }
 }
コード例 #2
0
ファイル: Logging.cs プロジェクト: Hydroxa/NanaManager
 /// <summary>
 /// Writes an error to the logs from the specified location at the specified severity level
 /// </summary>
 /// <param name="Error">The error to display</param>
 /// <param name="Location">The location of the error</param>
 /// <param name="Level">The severity of the error</param>
 public static void Write(Exception Error, string Location, LogLevel Level)
 {
     try {
         write(string.Format(FORMAT, string.Format(ERROR_FORMAT, Error.Source, Error.Message, Error.StackTrace, Error.GetType().Name), Location, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond, Enum.GetName(typeof(LogLevel), Level)));
         NewMessageAdvanced?.Invoke(string.Format(ERROR_FORMAT, Error.Source, Error.Message, Error.StackTrace, Error.GetType().Name), Location, Level, DateTime.Now, Error, null);
     } catch (InvalidOperationException) {
         throw;
     }
 }
コード例 #3
0
ファイル: Logging.cs プロジェクト: Hydroxa/NanaManager
 /// <summary>
 /// Writes a debug message to the logs from the specified location
 /// </summary>
 /// <param name="Message">The message to display</param>
 /// <param name="Location">The location the message came from</param>
 public static void Write(string Message, string Location)
 {
     try {
         write(string.Format(FORMAT, Message, Location, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond, "Debug"));
         NewMessageAdvanced?.Invoke(Message, Location, LogLevel.Info, DateTime.Now, null, null);
     } catch (InvalidOperationException) {
         throw;
     }
 }
コード例 #4
0
ファイル: Logging.cs プロジェクト: Hydroxa/NanaManager
 /// <summary>
 /// Write a message to the logs with no formatting
 /// </summary>
 /// <param name="Message">The message to add to the logs</param>
 public static void Write(string Message)
 {
     write(Message);
     NewMessageAdvanced?.Invoke(Message, null, LogLevel.Undefined, DateTime.Now, null, null);
 }
コード例 #5
0
ファイル: Logging.cs プロジェクト: Hydroxa/NanaManager
 public static void Write(Exception Error, string Location, LogLevel Level, int LogCode)
 {
     write(string.Format(NUM_FORMAT, string.Format(ERROR_FORMAT, Error.Source, Error.Message, Error.StackTrace, Error.GetType().Name), Location, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond, Enum.GetName(typeof(LogLevel), Level), Convert.ToString(LogCode, 16)));
     NewMessageAdvanced?.Invoke(string.Format(ERROR_FORMAT, Error.Source, Error.Message, Error.StackTrace, Error.GetType().Name), Location, Level, DateTime.Now, Error, LogCode);
 }