PHP Class MC4WP_Debug_Log

Simple logging class which writes to a file, loosely based on PSR-3.
Mostra file Open project: dannyvankooten/mailchimp-for-wordpress

Public Properties

Property Type Description
$file The file to which messages should be written.
$level Only write messages with this level or higher

Protected Properties

Property Type Description
$levels array Logging levels from syslog protocol defined in RFC 5424
$stream resource

Public Methods

Method Description
__construct ( string $file, $level = self::DEBUG ) MC4WP_Debug_Log constructor.
debug ( string $message ) : boolean
error ( string $message ) : boolean
get_level_name ( integer $level ) : string Gets the name of the logging level.
info ( string $message ) : boolean
log ( mixed $level, string $message ) : boolean
test ( ) : boolean Tests if the log file is writable
to_level ( $level ) : integer Converts PSR-3 levels to local ones if necessary
warning ( string $message ) : boolean

Method Details

__construct() public method

MC4WP_Debug_Log constructor.
public __construct ( string $file, $level = self::DEBUG )
$file string

debug() public method

public debug ( string $message ) : boolean
$message string
return boolean

error() public method

public error ( string $message ) : boolean
$message string
return boolean

get_level_name() public static method

Gets the name of the logging level.
public static get_level_name ( integer $level ) : string
$level integer
return string

info() public method

public info ( string $message ) : boolean
$message string
return boolean

log() public method

public log ( mixed $level, string $message ) : boolean
$level mixed
$message string
return boolean

test() public method

Tests if the log file is writable
public test ( ) : boolean
return boolean

to_level() public static method

Converts PSR-3 levels to local ones if necessary
public static to_level ( $level ) : integer
return integer

warning() public method

public warning ( string $message ) : boolean
$message string
return boolean

Property Details

$file public_oe property

The file to which messages should be written.
public $file

$level public_oe property

Only write messages with this level or higher
public $level

$levels protected_oe static_oe property

Logging levels from syslog protocol defined in RFC 5424
protected static array $levels
return array

$stream protected_oe property

protected resource $stream
return resource