Import std.log.logger
Logger
class
Public Shared Class Logger
Writes lines for a module, with the fields it's given, at levels, to an output. Its Trace, Debug, Info, Warn, and Error write a line at their level, when the output's filter writes that level for the module.
Examples
Const lines = Channel<String>(8)
Function Keep(line: String)
lines.Send(line)
End Function
Local output = LogOutput(LogFilter.At(LogLevel.INFO))
output.Add(JsonLinesSink(Keep))
Local log = Logger("shop", output).With("user", "ada")
log.Debug("not written, as DEBUG is below INFO")
log.Info("signed in")
Local line = lines.TryReceive() ?? ""
Expect(line.Contains("\"message\":\"signed in\"") && line.Contains("\"user\":\"ada\""))
Expect(lines.TryReceive() == Null)-
A Logger for
module, a name like "net.http" whose dots say what it's in, which writes to the default output. -
A Logger for
modulethat writes tooutput. -
The module it writes for.
-
The fields each of its lines has, in the order they were given.
-
A Logger like this one whose lines have the field too, after its others.
-
A Logger whose lines have the field
name, ofvalue's number, beside this one's: each of the eight integer types has one. -
A Logger whose lines have the field
name, ofvalue's number, beside this one's. -
A Logger whose lines have the field
name, ofvalue's number, beside this one's. -
A Logger whose lines have the field
name, ofvalue's number, beside this one's. -
A Logger whose lines have the field
name, ofvalue's number, beside this one's. -
A Logger whose lines have the field
name, ofvalue's number, beside this one's. -
A Logger whose lines have the field
name, ofvalue's number, beside this one's. -
A Logger whose lines have the field
name, ofvalue's number, beside this one's. -
A Logger whose lines have the field
name, ofvalue's number. A Double that isn't finite is text, since JSON has no number for it: "inf", "-inf", or "nan", whatever a NaN's sign bit. -
A Logger whose lines have the field
name, true or false, beside this one's. -
Whether a line at
levelwould be written, so code can leave out work that only a line would use. -
Writes
messageatlevel, now, when the output's filter writes it. -
Writes
messageat TRACE, as Log does. -
Writes
messageat DEBUG, as Log does. -
Writes
messageat INFO, as Log does. -
Writes
messageat WARN, as Log does. -
Writes
messageat ERROR, as Log does.
Report an issue with this page or with FutureBlitz on GitHub.