Overview

Namespaces

  • gregoryv
    • logger

Classes

  • CachedWriter
  • ConsoleWriter
  • FileWriter
  • Logger
  • State
  • SyslogWriter

Interfaces

  • SeverityWriterInterface
  • Overview
  • Namespace
  • Class

Class Logger

Loggers are used to send formated messages to the writers using specific log levels.

Default template of the message is context( INFO|WARNING|ERROR|DEBUG) message

Namespace: gregoryv\logger
Located at Logger.php
Methods summary
public
# __construct( mixed $context = '' )

Constructs a new logger where all messages are prefixed with the context. If the context is an object the class name of that object is used.

Constructs a new logger where all messages are prefixed with the context. If the context is an object the class name of that object is used.

Parameters

$context
string or class
public static
# setWriter( gregoryv\logger\SeverityWriterInterface $writer )

Set global writer for all your loggers

Set global writer for all your loggers

Parameters

$writer
public
# turn( string $toggle )

Sets logging state of the given severity level in a readable format

Sets logging state of the given severity level in a readable format

Parameters

$toggle
format: (on|off) [all] (debug|info|notice|warn|error|critical|alert|emergency)

Example

$log->turn('on debug');
$log->turn('off all warn');
public
# debug( $value = '' )

Debug (severity 7): debug-level messages

Debug (severity 7): debug-level messages

public
# debugf( )

Same as debug(sprintf($format, $args...))

Same as debug(sprintf($format, $args...))

public
# info( $value = '' )

Informational (severity 6): informational messages

Informational (severity 6): informational messages

public
# infof( )

Same as info(sprintf($format, $args...))

Same as info(sprintf($format, $args...))

public
# notice( $value = '' )

Notice (severity 5): normal but significant condition

Notice (severity 5): normal but significant condition

public
# noticef( )

Same as notice(sprintf($format, $args...))

Same as notice(sprintf($format, $args...))

public
# warn( $value = '' )

Warning (severity 4): warning conditions

Warning (severity 4): warning conditions

public
# warnf( )

Same as warn(sprintf($format, $args...))

Same as warn(sprintf($format, $args...))

public
# error( $value = '' )

Error (severity 3): error conditions

Error (severity 3): error conditions

public
# errorf( )

Same as error(sprintf($format, $args...))

Same as error(sprintf($format, $args...))

public
# critical( $value = '' )

Critical (severity 2): critical conditions

Critical (severity 2): critical conditions

public
# criticalf( )

Same as critical(sprintf($format, $args...))

Same as critical(sprintf($format, $args...))

public
# alert( $value = '' )

Alert (severity 1): action must be taken immediately

Alert (severity 1): action must be taken immediately

public
# alertf( )

Same as alert(sprintf($format, $args...))

Same as alert(sprintf($format, $args...))

public
# emergency( $value = '' )

Emergency (severity 0): system is unusable

Emergency (severity 0): system is unusable

public
# emergencyf( )

Same as emergency(sprintf($format, $args...))

Same as emergency(sprintf($format, $args...))

API documentation generated by ApiGen