phore / log
Logging class
Installs: 7 415
Dependents: 7
Suggesters: 1
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
- phore/core: *
- psr/log: ^1.1.4
Requires (Dev)
- phore/tester: *
This package is auto-updated.
Last update: 2024-12-12 09:38:41 UTC
README
- PSR-3 compliant logger
- Multiple targets (syslog, file, pipe) with individual configuration
- Quick configuration with single uri
- Multi-format support
Installation
composer require phore/log
Logger Usage
Easy usage
phore_Log("Some log message"); // Debug message phore_log("Value :val expected", ["val"=>"some unescaped value"]); // Auto escaping phore_log()->emergency("Emergency Message");
Configuration
Global configuration
PhoreLogger::Register(PhoreLoggerFactory::BuildFromUri("syslog+udp://metrics.host.tld:4200?tag=server1"));
Multi instance
$logger = PhoreLoggerFactory::BuildFromUri();
Logging
phore_log("something to log :message", ["message"=>"Hello"]);
phore_log()->setLogLevel(LogLevel::DEBUG);
phore_log()->emergency("emergency");
LogLevel
Logging configuration
You can specify one or more logger with different log levels.
syslog+udp://<hostname>:<port>/<tag>?severity=4&
syslogng+udp://
def://stdout?severity=4
def://stderr?severity=4
file:///var/log/xy.log?severity=4