Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Phore log :: PSR-3 compatible logger

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

LogLevel Code
LogLevel::EMERGENCY 0
LogLevel::ALERT 1
LogLevel::CRITICAL 2
LogLevel::ERROR 3
LogLevel::WARNING 4
LogLevel::NOTICE 5
LogLevel::INFO 6
LogLevel::DEBUG 7 (default)

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