Browse Source

Added trace log level

pull/32/head 3.13.1
Anairkoen Schno 5 years ago
parent
commit
c57fdfa83e
4 changed files with 49 additions and 3 deletions
  1. +8
    -0
      IPA.Loader/Config/SelfConfig.cs
  2. +29
    -1
      IPA.Loader/Logging/Logger.cs
  3. +4
    -2
      IPA.Loader/Logging/StandardLogger.cs
  4. +8
    -0
      docs/articles/command-line.md

+ 8
- 0
IPA.Loader/Config/SelfConfig.cs View File

@ -59,6 +59,9 @@ namespace IPA.Config
CommandLineValues.Updates.AutoCheckUpdates = false;
CommandLineValues.Updates.AutoUpdate = false;
break;
case "--trace":
CommandLineValues.Debug.ShowTrace = true;
break;
}
}
}
@ -118,6 +121,11 @@ namespace IPA.Config
public int HideLogThreshold = 512;
// LINE: ignore
public static int HideLogThreshold_ => SelfConfigRef.Value.Debug.HideLogThreshold;
public bool ShowTrace = false;
// LINE: ignore 2
public static bool ShowTrace_ => SelfConfigRef.Value.Debug.ShowTrace
|| CommandLineValues.Debug.ShowTrace;
}
public Debug_ Debug = new Debug_();


+ 29
- 1
IPA.Loader/Logging/Logger.cs View File

@ -56,6 +56,11 @@ namespace IPA.Logging
/// </summary>
None = 0,
/// <summary>
/// A trace message. These are ignored *incredibly* early.
/// </summary>
Trace = 32,
/// <summary>
/// A debug message.
/// </summary>
@ -98,6 +103,8 @@ namespace IPA.Logging
/// </summary>
None = Level.None,
TraceOnly = Level.Trace,
/// <summary>
/// Only shows Debug messages.
/// </summary>
@ -148,10 +155,15 @@ namespace IPA.Logging
/// </summary>
InfoUp = InfoOnly | NoticeUp,
/// <summary>
/// Shows all messages debug and up.
/// </summary>
DebugUp = DebugOnly | InfoUp,
/// <summary>
/// Shows all messages.
/// </summary>
All = DebugOnly | InfoUp,
All = TraceOnly | DebugUp,
/// <summary>
/// Used for when the level is undefined.
@ -173,6 +185,22 @@ namespace IPA.Logging
/// <param name="e">the exception to log</param>
public virtual void Log(Level level, Exception e) => Log(level, e.ToString());
/// <summary>
/// Sends a trace message.
/// Equivalent to `Log(Level.Trace, message);`
/// </summary>
/// <seealso cref="Log(Level, string)"/>
/// <param name="message">the message to log</param>
public virtual void Trace(string message) => Log(Level.Trace, message);
/// <summary>
/// Sends an exception as a trace message.
/// Equivalent to `Log(Level.Trace, e);`
/// </summary>
/// <seealso cref="Log(Level, Exception)"/>
/// <param name="e">the exception to log</param>
public virtual void Trace(Exception e) => Log(Level.Trace, e);
/// <summary>
/// Sends a debug message.
/// Equivalent to `Log(Level.Debug, message);`


+ 4
- 2
IPA.Loader/Logging/StandardLogger.cs View File

@ -112,8 +112,8 @@ namespace IPA.Logging
/// <param name="cfg"></param>
internal static void Configure(SelfConfig cfg)
{
showSourceClass = cfg.Debug.ShowCallSource;
PrintFilter = cfg.Debug.ShowDebug ? LogLevel.All : LogLevel.InfoUp;
showSourceClass = SelfConfig.Debug_.ShowCallSource_;
PrintFilter = SelfConfig.Debug_.ShowDebug_ ? LogLevel.All : LogLevel.InfoUp;
}
private StandardLogger(StandardLogger parent, string subName)
@ -187,6 +187,8 @@ namespace IPA.Logging
if (message == null)
throw new ArgumentNullException(nameof(message));
if (!SelfConfig.Debug_.ShowTrace_ && level == Level.Trace) return;
// make sure that the queue isn't being cleared
logWaitEvent.Wait();
logQueue.Add(new LogMessage


+ 8
- 0
docs/articles/command-line.md View File

@ -33,6 +33,14 @@ Here's a quick list of what they are and what they do.
> This overrides the config settings `Debug.ShowDebug` and `Debug.ShowCallSource`.
>
- `--trace`
> Enables trace level messages. By default, they do not ever enter the message queue, and thus cost almost nothing.
> When this or the config option is used, they are added and logged with the same rules as Debug messages.
>
> This overrides the config setting `Debug.ShowTrace`.
>
- `--mono-debug`
> Enables the built-in Mono soft debugger engine.


Loading…
Cancel
Save