log (php-fig/log)
Searching Database…
What is this?
This is the PSR-3 standard package: a set of interfaces, classes and traits (centered on Psr\Log\LoggerInterface) that describe what a PHP logger should look like, so different libraries can share a common logging contract.
Is this a logger I can use directly, or just a specification?
It is purely a specification — no actual logging engine, file writer, or handlers are included; you still need a real logger that implements the interface.
How do I actually use this in a project?
Type-hint against Psr\Log\LoggerInterface in your own code, then plug in any logger that implements it; if you're building your own logger, require this package and implement the interface yourself.
Do I need to write a logger from scratch to use this?
No — you only need a PSR-3-compatible logging library (such as Monolog) that already implements the interface; this package just defines the contract you code against.
Does this package write logs on its own?
No, it has no runtime logging behavior at all — it's strictly interfaces, classes and traits describing the contract, with the real work left to whichever implementation you choose.
What's included besides the LoggerInterface?
The package also ships supporting classes and traits tied to the PSR-3 spec, giving a consistent base for implementing the standard log-level methods (debug, info, error, etc.).
Why would I use this instead of just picking a logging library?
PSR-3 is a shared contract: coding against Psr\Log\LoggerInterface lets your code work with any compliant logger (like Monolog) without locking you into one implementation.
Is there a reference implementation bundled in?
No, it is intentionally implementation-free — you bring your own logger class that implements Psr\Log\LoggerInterface, as described in the full specification.
What are similar projects?
monolog, container, Slim, agentmemoryrepo, agentskills, pino, CocoaLumberjack, is-a-software
Which topics is it in?
standard, software, specification, logging, package-manager, php, backend, api, library, developer-tools, mit, open-source