This is just Jetbrains formatting and code syntax styling
This commit is contained in:
+25
-26
@@ -7,36 +7,35 @@ using SptCommon.Annotations;
|
||||
using Core.Models.Logging;
|
||||
using Core.Models.Utils;
|
||||
|
||||
namespace ExampleMods.Mods
|
||||
namespace ExampleMods.Mods;
|
||||
|
||||
[Injectable]
|
||||
public class Logging
|
||||
{
|
||||
[Injectable]
|
||||
public class Logging
|
||||
private readonly ISptLogger<Logging> _logger;
|
||||
|
||||
// Constructor - Inject a 'ISptLogger' with your mods Class in the diamond brackets
|
||||
public Logging(
|
||||
ISptLogger<Logging> logger)
|
||||
{
|
||||
private readonly ISptLogger<Logging> _logger;
|
||||
// Save the logger we're injecting into a private variable that is scoped to this class (only this class has access to it)
|
||||
_logger = logger;
|
||||
|
||||
// Constructor - Inject a 'ISptLogger' with your mods Class in the diamond brackets
|
||||
public Logging(
|
||||
ISptLogger<Logging> logger)
|
||||
{
|
||||
// Save the logger we're injecting into a private variable that is scoped to this class (only this class has access to it)
|
||||
_logger = logger;
|
||||
// Not 100% necessary but let's split our code out into a method to make it easier to read
|
||||
Run();
|
||||
}
|
||||
|
||||
// Not 100% necessary but let's split our code out into a method to make it easier to read
|
||||
Run();
|
||||
}
|
||||
public void Run()
|
||||
{
|
||||
// We can access the logger to assigned in the constructor here
|
||||
_logger.Success("This is a success message");
|
||||
_logger.Warning("This is a warning message");
|
||||
_logger.Error("This is an error message");
|
||||
_logger.Info("This is an info message");
|
||||
_logger.Critical("this is a critical message");
|
||||
|
||||
public void Run()
|
||||
{
|
||||
// We can access the logger to assigned in the constructor here
|
||||
_logger.Success("This is a success message");
|
||||
_logger.Warning("This is a warning message");
|
||||
_logger.Error("This is an error message");
|
||||
_logger.Info("This is an info message");
|
||||
_logger.Critical("this is a critical message");
|
||||
|
||||
// Logging with colors requires you to 'pass' the text color and background color
|
||||
_logger.LogWithColor("This is a message with custom colors", LogTextColor.Red, LogBackgroundColor.Black);
|
||||
_logger.Debug("This is a debug message that gets written to the log file, not the console");
|
||||
}
|
||||
// Logging with colors requires you to 'pass' the text color and background color
|
||||
_logger.LogWithColor("This is a message with custom colors", LogTextColor.Red, LogBackgroundColor.Black);
|
||||
_logger.Debug("This is a debug message that gets written to the log file, not the console");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user