phore/log

Logging class

v2.0.2 2024-05-08 10:21 UTC

This package is auto-updated.

Last update: 2024-11-08 11:16:07 UTC


README

Actions Status

  • 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