Class Log
The static class for logging.
Inheritance
System.Object
Log
Namespace: black.kit.toybox
Assembly: cs.temp.dll.dll
Syntax
public static class Log
Fields
DEFAULT_COLOR
The default color for logging.
Declaration
public const string DEFAULT_COLOR = "red"
Field Value
Type | Description |
---|---|
System.String |
DEFAULT_TAG
The default tag for logging.
Declaration
public const string DEFAULT_TAG = "toybox"
Field Value
Type | Description |
---|---|
System.String |
Methods
CreateMessage(String, String, String)
Create a message with a tag and a color.
Declaration
public static string CreateMessage(string message, string tag = "toybox", string color = "red")
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message |
System.String | tag | specify the tag |
System.String | color | specify the color |
Returns
Type | Description |
---|---|
System.String | The message with a tag and a color |
Examples
Log.CreateMessage("Hello, World!");
// "[<color=red>toybox</color>] Hello, World!"
Log.CreateMessage("Hello, World!", "MyTag");
// "[<color=red>MyTag</color>] Hello, World!"
Log.CreateMessage("Hello, World!", "MyTag", "blue");
// "[<color=blue>MyTag</color>] Hello, World!"
Error(String, String, String)
Log a error message with a tag and a color.
Declaration
public static void Error(string message, string tag = "toybox", string color = "red")
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message |
System.String | tag | specify the tag |
System.String | color | specify the color |
Examples
Log.Error("Hello, World!");
// 🛑 Log: "[<color=red>toybox</color>] Hello, World!"
Log.Error("Hello, World!", "MyTag");
// 🛑 Log: "[<color=red>MyTag</color>] Hello, World!"
Log.Error("Hello, World!", "MyTag", "blue");
// 🛑 Log: "[<color=blue>MyTag</color>] Hello, World!"
Info(String, String, String)
Log a message with a tag and a color.
Declaration
public static void Info(string message, string tag = "toybox", string color = "red")
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message |
System.String | tag | specify the tag |
System.String | color | specify the color |
Examples
Log.Info("Hello, World!");
// ℹ️ Log: "[<color=red>toybox</color>] Hello, World!"
Log.Info("Hello, World!", "MyTag");
// ℹ️ Log: "[<color=red>MyTag</color>] Hello, World!"
Log.Info("Hello, World!", "MyTag", "blue");
// ℹ️ Log: "[<color=blue>MyTag</color>] Hello, World!"
Warn(String, String, String)
Log a warning message with a tag and a color.
Declaration
public static void Warn(string message, string tag = "toybox", string color = "red")
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message |
System.String | tag | specify the tag |
System.String | color | specify the color |
Examples
Log.Warn("Hello, World!");
// ⚠️ Log: "[<color=red>toybox</color>] Hello, World!"
Log.Warn("Hello, World!", "MyTag");
// ⚠️ Log: "[<color=red>MyTag</color>] Hello, World!"
Log.Warn("Hello, World!", "MyTag", "blue");
// ⚠️ Log: "[<color=blue>MyTag</color>] Hello, World!"