This repository has been archived by the owner on Oct 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(style): fix various warnings (#316)
- Loading branch information
1 parent
027139f
commit 514c029
Showing
10 changed files
with
184 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,76 @@ | ||
namespace Jellyfin.Plugin.Themerr.Tests | ||
{ | ||
/// <summary> | ||
/// A simple logger for tests | ||
/// A simple logger for tests. | ||
/// </summary> | ||
public static class TestLogger | ||
{ | ||
// log a message to console | ||
private static ITestOutputHelper? _output; | ||
|
||
public static void Initialize(ITestOutputHelper output) | ||
{ | ||
_output = output ?? throw new ArgumentNullException(nameof(output)); | ||
} | ||
|
||
/// <summary> | ||
/// Logs a message to the test output | ||
/// Initializes the logger with the given output. | ||
/// </summary> | ||
/// <param name="message"></param> | ||
/// <param name="type"></param> | ||
public static void Log(string message, string type = "INFO") | ||
/// <param name="output">The output to log to.</param> | ||
/// <exception cref="ArgumentNullException">Thrown when the output is null.</exception> | ||
public static void Initialize(ITestOutputHelper output) | ||
{ | ||
_output?.WriteLine($"[{type}] {message}"); | ||
_output = output ?? throw new ArgumentNullException(nameof(output)); | ||
} | ||
|
||
/// <summary> | ||
/// Logs a critical message to the test output | ||
/// Logs a critical message to the test output. | ||
/// </summary> | ||
/// <param name="message"></param> | ||
/// <param name="message">The message to log.</param> | ||
public static void Critical(string message) | ||
{ | ||
Log(message, "CRITICAL"); | ||
} | ||
|
||
/// <summary> | ||
/// Logs a debug message to the test output | ||
/// Logs a debug message to the test output. | ||
/// </summary> | ||
/// <param name="message"></param> | ||
/// <param name="message">The message to log.</param> | ||
public static void Debug(string message) | ||
{ | ||
Log(message, "DEBUG"); | ||
} | ||
|
||
/// <summary> | ||
/// Logs an error message to the test output | ||
/// Logs an error message to the test output. | ||
/// </summary> | ||
/// <param name="message"></param> | ||
/// <param name="message">The message to log.</param> | ||
public static void Error(string message) | ||
{ | ||
Log(message, "ERROR"); | ||
} | ||
|
||
/// <summary> | ||
/// Logs an info message to the test output | ||
/// Logs an info message to the test output. | ||
/// </summary> | ||
/// <param name="message"></param> | ||
/// <param name="message">The message to log.</param> | ||
public static void Info(string message) | ||
{ | ||
Log(message, "INFO"); | ||
Log(message); | ||
} | ||
|
||
/// <summary> | ||
/// Logs a warning message to the test output | ||
/// Logs a warning message to the test output. | ||
/// </summary> | ||
/// <param name="message"></param> | ||
/// <param name="message">The message to log.</param> | ||
public static void Warn(string message) | ||
{ | ||
Log(message, "WARN"); | ||
} | ||
|
||
/// <summary> | ||
/// Logs a message to the test output. | ||
/// </summary> | ||
/// <param name="message">The message to log.</param> | ||
/// <param name="type">The type of message to log.</param> | ||
private static void Log(string message, string type = "INFO") | ||
{ | ||
_output?.WriteLine($"[{type}] {message}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.