lib/log
import "github.com/eugenioenko/goalchemy/lib/log"Package log routes structured log records from Goalchemy programs to a sink the host application installs.
| Function | c | csharp | go | java | python | rust | swift | typescript |
|---|---|---|---|---|---|---|---|---|
Emit |
yes | yes | yes | yes | yes | yes | yes | yes |
Enabled |
yes | yes | yes | yes | yes | yes | yes | yes |
func Emit(level int, unixNano int64, message string, attrs []string, text string)Delivers one structured log record to the host log sink.
- Gate:
sequential(never suspends) - Determinism: nondeterministic
- Bounds: attrs holds key/value pairs; an odd final element is ignored. Group names are already joined to keys with ‘.’.
- Errors: No error result. Exceptions or panics raised by a host sink are discarded.
- Contract:
lib.log.emit1.0.0
Enabled
Section titled “Enabled”func Enabled(level int) boolReports whether the host log sink accepts records at a level.
- Gate:
sequential(never suspends) - Determinism: nondeterministic
- Bounds: Levels follow log/slog: -4 debug, 0 info, 4 warn, 8 error; any int is valid. The result is level >= the host’s minimum level.
- Errors: No error result.
- Contract:
lib.log.enabled1.0.0