PHP Class Pop\Log\Logger

Author: Nick Sagona, III ([email protected])
Show file Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$priorities array Message priority short codes
$timestamp string Log timestamp format
$writers array Log writers

Public Methods

Method Description
__construct ( Pop\Log\Writer\WriterInterface $writer = null ) : Logger Constructor
addWriter ( Pop\Log\Writer\WriterInterface $writer ) : Logger Method to add a log writer
alert ( mixed $message, array $options = [] ) : Logger Method to add an ALERT log entry
crit ( mixed $message, array $options = [] ) : Logger Method to add a CRIT log entry
debug ( mixed $message, array $options = [] ) : Logger Method to add a DEBUG log entry
emerg ( mixed $message, array $options = [] ) : Logger Method to add an EMERG log entry
err ( mixed $message, array $options = [] ) : Logger Method to add an ERR log entry
getTimestamp ( ) : string Method to get timestamp format
getWriters ( ) : array Method to get all log writers
info ( mixed $message, array $options = [] ) : Logger Method to add an INFO log entry
log ( integer $priority, mixed $message, array $options = [] ) : Logger Method to add a log entry
notice ( mixed $message, array $options = [] ) : Logger Method to add a NOTICE log entry
setTimestamp ( string $format = 'Y-m-d H:i:s' ) : Logger Method to set timestamp format
warn ( mixed $message, array $options = [] ) : Logger Method to add a WARN log entry

Method Details

__construct() public method

Instantiate the logger object.
public __construct ( Pop\Log\Writer\WriterInterface $writer = null ) : Logger
$writer Pop\Log\Writer\WriterInterface
return Logger

addWriter() public method

Method to add a log writer
public addWriter ( Pop\Log\Writer\WriterInterface $writer ) : Logger
$writer Pop\Log\Writer\WriterInterface
return Logger

alert() public method

Method to add an ALERT log entry
public alert ( mixed $message, array $options = [] ) : Logger
$message mixed
$options array
return Logger

crit() public method

Method to add a CRIT log entry
public crit ( mixed $message, array $options = [] ) : Logger
$message mixed
$options array
return Logger

debug() public method

Method to add a DEBUG log entry
public debug ( mixed $message, array $options = [] ) : Logger
$message mixed
$options array
return Logger

emerg() public method

Method to add an EMERG log entry
public emerg ( mixed $message, array $options = [] ) : Logger
$message mixed
$options array
return Logger

err() public method

Method to add an ERR log entry
public err ( mixed $message, array $options = [] ) : Logger
$message mixed
$options array
return Logger

getTimestamp() public method

Method to get timestamp format
public getTimestamp ( ) : string
return string

getWriters() public method

Method to get all log writers
public getWriters ( ) : array
return array

info() public method

Method to add an INFO log entry
public info ( mixed $message, array $options = [] ) : Logger
$message mixed
$options array
return Logger

log() public method

Method to add a log entry
public log ( integer $priority, mixed $message, array $options = [] ) : Logger
$priority integer
$message mixed
$options array
return Logger

notice() public method

Method to add a NOTICE log entry
public notice ( mixed $message, array $options = [] ) : Logger
$message mixed
$options array
return Logger

setTimestamp() public method

Method to set timestamp format
public setTimestamp ( string $format = 'Y-m-d H:i:s' ) : Logger
$format string
return Logger

warn() public method

Method to add a WARN log entry
public warn ( mixed $message, array $options = [] ) : Logger
$message mixed
$options array
return Logger

Property Details

$priorities protected property

Message priority short codes
protected array $priorities
return array

$timestamp protected property

Log timestamp format
protected string $timestamp
return string

$writers protected property

Log writers
protected array $writers
return array