RSL_ Log Package Documentation
- A logging package based on Zap secondary encapsulation.
- It is mainly used for the development of RedStone Launcher, as well as other applications.
Latest Version: 1.0.0_beta
中文文档见 RSL_Log_中文文档
Index
Functions
File Operations
- InitLauncherLogger()
Called before any log operation.
Other operations can be performed only after initialization is successful.
- ClearLogs() error
All log files except the last three will be deleted.
(Files ending in “. log” in the log folder)
Log Operations
The input string and parameters will be recorded in the log at different levels.
(If successfully initialized)
By default, the logged logs are also output to the console.
You can adjust the parameters to prevent them from being output to the console.
- LogInfo(format string, args …interface{})
- LogDebug(format string, args …interface{})
- LogWarning(format string, args …interface{})
- LogError(format string, args …interface{}
Output operations
Output the input string to the console.
It can be called at any time without initialization.
- PrintInfo(format string, args …interface{})
- PrintDebug(format string, args …interface{})
- PrintWarning(format string, args …interface{})
- PrintError(format string, args …interface{})
Variables
About Paths
- LogFolder = “./LauncherLog/”
This path is the default output path of the log file. If it does not exist, it will be created automatically.
Modify it to output the log file to a different path.
Automation settings
- LogtoConsole = true
Output the information written to the log file to the console at the same time.
Examples
Code
package main
import "RedStoneLauncher/RSL_Log"
func main() {
RSL_Log.InitLauncherLogger()
a := RSL_Log.ClearLogs()
if a != nil {
println(a.Error())
}
RSL_Log.GetVersion()
}
OutPut
...
[INFO] Year-Month-Date_Hour-Min-Sec | Init Logger successfully!
[INFO] Year-Month-Date_Hour-Min-Sec | RSL_Log version:[1.0.0_beta]