Did you know ... | Search Documentation: |
![]() | Packs (add-ons) for SWI-Prolog |
Title: | Logging for Prolog |
---|---|
Rating: | Not rated. Create the first rating! |
Latest version: | 0.0.2 |
SHA1 sum: | a24d40f2cf68bbaeab7221a6ce8c8dd92a46531c |
Author: | Phil Hargett <phil@haphazardhouse.net> |
Maintainer: | Phil Hargett <phil@haphazardhouse.net> |
Packager: | Phil Hargett <phil@haphazardhouse.net> |
Home page: | https://github.com/hargettp/log4p |
Provides: | logger |
No reviews. Create the first review!.
Version | SHA1 | #Downloads | URL |
---|---|---|---|
0.0.2 | a24d40f2cf68bbaeab7221a6ce8c8dd92a46531c | 107 | https://github.com/hargettp/log4p/archive/v0.0.2.zip |
A simple logging library for Prolog, inspired by log4j.
This is a package for SWI-Prolog, installable using the built-in package manager with the package name log4p
.
?- pack_install(log4p).
The basic model for logging involves a few simple concepts.
trace
, debug
, info
, warn
, error
, fatal
. If the current log level is set to info
, for example, then message of debug
or to further left in that list will not be given to a handler.
Generating messages is usually a matter of using a number of predicates named for each level: info/1, info/2, warn/1, warn/2 etc. The `/1` variant logs a constant string (or term rendered as a string). The `/2` variant takes a format string and an array of arguments, then calls swritef
to generate a constant string which is then passed onto log handlers.
The current level can be set using the set_log_level/2 predicate, which will also return the previous value.
To add or remove log handlers, use add_log_handler/1 and remove_log_handler/1 respectively.
Pack contains 5 files holding a total of 5.3K bytes.