| Did you know ... | Search Documentation: |
| Pack log4p -- AGENTS.md |
log4p is a simple logging library for Prolog, inspired by log4j. It provides a straightforward API for logging messages at different severity levels (trace, debug, info, warn, error, fatal) with support for handlers that direct log output to various destinations.
log4p/ âââ prolog/ # Prolog source code for the library âââ docs/ # Project documentation (Architecture, API, concepts, examples) âââ features/ # Feature planning and tracking (planned work with checkboxes) âââ README.md # Quick start and usage guide âââ AGENTS.md # This file â guide for developers and AI assistants âââ pack.pl # SWI-Prolog package metadata âââ test.pl # Tests
Documentation files that help understand and work with log4p:
Each planned or in-progress feature gets a dedicated Markdown file with:
?- pack_install(log4p).
test.pl to verify functionality like features/my-feature.md`- [ ] checkboxes in the Plan section to track progress# Feature: Custom Log Format ## Overview Allow users to customize log message formatting beyond the default format. ## Goal Implement a predicate `set_log_format/1` that accepts a format string/template. ## Assumptions - Format strings use a simple template syntax - Users need this for integration with existing systems ## Plan - [ ] Design format string syntax - [ ] Implement parser for format strings - [ ] Update handlers to use custom format - [ ] Write tests - [ ] Update documentation
?- consult('test.pl').
When contributing to log4p:
trace â Most verbose, for detailed tracingdebug â Debug informationinfo â Informational messages (default level)warn â Warning messageserror â Error messagesfatal â Severe errors
Messages at or above the current log level are emitted; lower levels are filtered out.Handlers are predicates that accept formatted messages and emit them to destinations (stdout, stderr, files, etc.). Each thread maintains its own set of handlers.
The effective log level per-thread is determined by (in priority order):
info (built-in default)