Skip to content

UniFunction/UniF-Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

UniF-Logger

Usage

Before it, you must tag yourself unif.debug.

And following is a log example.

[0:1000] [INFO] (NAMESPACE) MESSAGE
  • [0:1000] is the time of the game. It means that the log was printed at the time of 1000 on day 1 of the game.
  • [INFO] is the level of the log. There are a total of 5 levels, ALL < DEBUG < INFO < WARN < ERROR.
  • (Namespace) is the namespace of the logger.

After logging but logging of DEBUG, all logging will record into stoarge unif.logger:logs, and there are also 4 stoarges: unif.logger:debug_logs, unif.logger:info_logs, unif.logger:warn_logs, unif.logger:error_logs.

When the logs is going to be too big, it will auto delete the last log in logs.

Logger

This is a simple example to print a info log.

function #unif.logger:logger/v1/debug {"msg": 'Here\'s some messages!', "namespace": "Test"}

And then, it will print a log.

Injected Logger

This is a simple example to print a injected info log.

Warning: Injected Logger can inject clickable JSON fields like clickEvent..

function #unif.logger:injected_logger/v1/info {"msg": "{\"text\":\"Injected Info Test\"}", "namespace": "Test"}

function #unif.logger:injected_logger/v1/info {"msg":"{\"text\":\"Injected Info Test\",\"hoverEvent\":{\"action\":\"show_text\",\"contents\":\"aa\"}}","namespace":"UniF-Logger"}

Logs

Read logs

You can use the following functions to read logs in the past.

function #unif.logger:logs/v1/read_all
function #unif.logger:logs/v1/read_debug
function #unif.logger:logs/v1/read_info
function #unif.logger:logs/v1/read_warn
function #unif.logger:logs/v1/read_error

Clear logs

You can use the following functions to clear logs.

function #unif.logger:logs/v1/clear_all
function #unif.logger:logs/v1/clear_debug
function #unif.logger:logs/v1/clear_info
function #unif.logger:logs/v1/clear_warn
function #unif.logger:logs/v1/clear_error