File tree Expand file tree Collapse file tree 4 files changed +24
-22
lines changed
Expand file tree Collapse file tree 4 files changed +24
-22
lines changed Original file line number Diff line number Diff line change 44-- @type Logger
55local Logger = {}
66
7+ --- Create a new logger
8+ -- @function Logger
9+ -- @param name The name of the logger
10+ -- @param level The logging level of the logger
11+ -- @param sinks The list of sinks to write the log entries in
712setmetatable (Logger , {
813 __call = function (cls , ...)
914 return cls :new (... )
@@ -12,11 +17,6 @@ setmetatable(Logger, {
1217
1318local Level = require (" structlog.level" )
1419
15- --- Create a new logger
16- -- @function new
17- -- @param name The name of the logger
18- -- @param level The logging level of the logger
19- -- @param sinks The list of sinks to write the log entries in
2020function Logger :new (name , level , sinks )
2121 local logger = {}
2222
Original file line number Diff line number Diff line change 55local Console = {}
66local KeyValue = require (" structlog.formatters.key_value" )
77
8+ --- Create a new console writer
9+ -- @function Console
10+ -- @param opts Optional parameters
11+ -- @param opts.async Make the logger async, default: True
12+ -- @param opts.processors The list of processors to chain the log entries in
13+ -- @param opts.formatter The formatter to format the log entries
814setmetatable (Console , {
915 __call = function (cls , ...)
1016 return cls :new (... )
1117 end ,
1218})
1319
14- --- Create a new console writer
15- -- @function new
16- -- @param opts Optional parameters
17- -- @param opts.async Make the logger async, default: True
18- -- @param opts.processors The list of processors to chain the log entries in
19- -- @param opts.formatter The formatter to format the log entries
2020function Console :new (opts )
2121 opts = opts or {}
2222
Original file line number Diff line number Diff line change 55local File = {}
66local KeyValue = require (" structlog.formatters.key_value" )
77
8+ --- Create a new file writer.
9+ -- @function File
10+ -- @param path The path to the logging file
11+ -- @param opts Optional parameters
12+ -- @param opts.processors The list of processors to chain the log entries in
13+ -- @param opts.formatter The formatter to format the log entries
814setmetatable (File , {
915 __call = function (cls , ...)
1016 return cls :new (... )
1117 end ,
1218})
1319
14- --- Create a new file writer.
15- -- @param path The path to the logging file
16- -- @param opts Optional parameters
17- -- @param opts.processors The list of processors to chain the log entries in
18- -- @param opts.formatter The formatter to format the log entries
1920function File :new (path , opts )
2021 opts = opts or {}
2122
Original file line number Diff line number Diff line change 55local RotatingFile = {}
66local File = require (" structlog.sinks.file" )
77
8- setmetatable (RotatingFile , {
9- __call = function (cls , ...)
10- return cls :new (... )
11- end ,
12- })
13-
148--- Create a new rotating file writer.
9+ -- @function RotatingFile
1510-- @param path The path to the logging file
1611-- @param opts Optional parameters
1712-- @param opts.processors The list of processors to chain the log entries in
1813-- @param opts.formatter The formatter to format the log entries
1914-- @param opts.max_size Maximum size of the file in bytes
2015-- @param opts.max_age Maximum age of the file is seconds
2116-- @param opts.time_format The time format used for renaming the log, default: "%F-%H:%M:%S"
17+ setmetatable (RotatingFile , {
18+ __call = function (cls , ...)
19+ return cls :new (... )
20+ end ,
21+ })
22+
2223function RotatingFile :new (path , opts )
2324 opts = opts or {}
2425
You can’t perform that action at this time.
0 commit comments