48 lines
1.1 KiB
Plaintext
48 lines
1.1 KiB
Plaintext
|
using System;
|
||
|
|
||
|
namespace AniNIX.Shared {
|
||
|
|
||
|
public enum Verbosity {
|
||
|
Always = -2,
|
||
|
Error,
|
||
|
Quiet = 0,
|
||
|
Verbose,
|
||
|
VeryVerbose,
|
||
|
Explicit,
|
||
|
}
|
||
|
|
||
|
public static class ReportMessage {
|
||
|
|
||
|
// Set this statically here, but allow others to override.
|
||
|
public static Verbosity verbosity = Verbosity.Quiet;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Log a new message for the user.
|
||
|
/// </summary>
|
||
|
public static void Log(Verbosity level,String message) {
|
||
|
|
||
|
if (level == Verbosity.Error) {
|
||
|
Console.Error.WriteLine(message);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (ReportMessage.verbosity == Verbosity.Quiet) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (level == Verbosity.Always
|
||
|
|| (ReportMessage.verbosity == Verbosity.Verbose && level == Verbosity.Verbose)
|
||
|
|| (ReportMessage.verbosity == Verbosity.VeryVerbose && (level == Verbosity.Verbose || level == Verbosity.VeryVerbose))
|
||
|
|| (ReportMessage.verbosity == Verbosity.Explicit && (level == Verbosity.Verbose || level == Verbosity.VeryVerbose || level == Verbosity.Explicit))
|
||
|
) {
|
||
|
Console.WriteLine(message);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public static void Log(String message) {
|
||
|
Log(Verbosity.VeryVerbose,message);
|
||
|
}
|
||
|
}
|
||
|
}
|