# Class Thelia\Log\Tlog | thelia

# Class Tlog

Thelia Logger

Allow to define different level and output.

  Thelia\Log\Tlog implements Psr\Log\LoggerInterface

Namespace: Thelia\Log
Author: Franck Allimant <franck@cqfdev.fr>
Author: Manuel Raynaud <mraynaud@openstudio.fr>
Located at core/lib/Thelia/Log/Tlog.php

Methods summary

`public static `Thelia\Log\Tlog``

# `getInstance( )`

#### Returns

``Thelia\Log\Tlog``

`protected` | # `init( )` initialize default configuration initialize default configuration

`public`

# `setDestinations( string $destinations )`

#### Parameters

$destinations
  `string`
  $destinations

`public`

# `setLevel( integer $level )`

change the debug level. Use Tlog constant : \Thelia\Log\Tlog::DEBUG set level to Debug

#### Parameters

$level
  `integer`
  $level

`public` | # `setPrefix( mixed $prefixe )`
`public` | # `setFiles( mixed $files )`
`public` | # `setIp( mixed $ips )`
`public` | # `setShowRedirect( mixed $bool )`
`public` | # `setConfig( mixed $destination, mixed $param, mixed $valeur )`
`public` | # `getConfig( mixed $destination, mixed $param )`

`public null`

# `debug( string $message, array $context = array() )`

Detailed debug information.

Detailed debug information.

#### Parameters

$message
  `string`
  $message
$context
  `array`
  $context

#### Returns

`null`

`public` | # `addDebug( )` Alias of debug method. With this method you can put all parameter you want ex : Tlog::getInstance()->addDebug($arg1, $arg2, $arg3);

`public null`

# `info( string $message, array $context = array() )`

Interesting events.

Interesting events.

Example: User logs in, SQL logs.

#### Parameters

$message
  `string`
  $message
$context
  `array`
  $context

#### Returns

`null`

`public` | # `addInfo( )` Alias of info method. With this method you can put all parameter you want ex : Tlog::getInstance()->addInfo($arg1, $arg2, $arg3);

`public null`

# `notice( string $message, array $context = array() )`

Normal but significant events.

Normal but significant events.

#### Parameters

$message
  `string`
  $message
$context
  `array`
  $context

#### Returns

`null`

`public` | # `addNotice( )` Alias of notice method. With this method you can put all parameter you want ex : Tlog::getInstance()->addNotice($arg1, $arg2, $arg3);

`public null`

# `warning( string $message, array $context = array() )`

Exceptional occurrences that are not errors.

Exceptional occurrences that are not errors.

Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.

#### Parameters

$message
  `string`
  $message
$context
  `array`
  $context

#### Returns

`null`

`public` | # `addWarning( )` Alias of warning method. With this method you can put all parameter you want ex : Tlog::getInstance()->addWarning($arg1, $arg2, $arg3);

`public null`

# `error( string $message, array $context = array() )`

Runtime errors that do not require immediate action but should typically be logged and monitored.

Runtime errors that do not require immediate action but should typically be logged and monitored.

#### Parameters

$message
  `string`
  $message
$context
  `array`
  $context

#### Returns

`null`

`public` | # `addError( )` Alias of error method. With this method you can put all parameter you want ex : Tlog::getInstance()->addError($arg1, $arg2, $arg3);

`public`

# `err( mixed $message, array $context = array() )`

#### See

``Thelia\Log\Tlog::error()``

`public null`

# `critical( string $message, array $context = array() )`

Critical conditions.

Critical conditions.

Example: Application component unavailable, unexpected exception.

#### Parameters

$message
  `string`
  $message
$context
  `array`
  $context

#### Returns

`null`

`public` | # `addCritical( )` Alias of critical method. With this method you can put all parameter you want ex : Tlog::getInstance()->addCritical($arg1, $arg2, $arg3);

`public`

# `crit( mixed $message, array $context = array() )`

#### See

``Thelia\Log\Tlog::critical()``

`public null`

# `alert( string $message, array $context = array() )`

Action must be taken immediately.

Action must be taken immediately.

Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

#### Parameters

$message
  `string`
  $message
$context
  `array`
  $context

#### Returns

`null`

`public` | # `addAlert( )` Alias of alert method. With this method you can put all parameter you want ex : Tlog::getInstance()->addAlert($arg1, $arg2, $arg3);

`public null`

# `emergency( string $message, array $context = array() )`

System is unusable.

System is unusable.

#### Parameters

$message
  `string`
  $message
$context
  `array`
  $context

#### Returns

`null`

`public` | # `addEmergency( )` Alias of emergency method. With this method you can put all parameter you want ex : Tlog::getInstance()->addEmergency($arg1, $arg2, $arg3);

`public null`

# `log( mixed $level, string $message, array $context = array() )`

Logs with an arbitrary level.

Logs with an arbitrary level.

#### Parameters

$level
  `mixed`
  $level
$message
  `string`
  $message
$context
  `array`
  $context

#### Returns

`null`

`public static` | # `SetBackOfficeMode( mixed $booleen )`

`public`

# `write( string & $res )`

final end method. Write log for each destination handler

#### Parameters

$res
  `string`
  $res

`public`

# `writeOnExit( )`

#### See

``Thelia\Log\Tlog::write()``

`public` | # `showRedirect( mixed $url )`

`public boolean`

# `isActivated( integer $level )`

check if level is activated and control if current file is activated

#### Parameters

$level
  `integer`
  $level

#### Returns

`boolean`

`public boolean`

# `isActivedFile( string $file )`

check if $file is in authorized files

#### Parameters

$file
  `string`
  $file

#### Returns

`boolean`

`protected` | # `interpolate( mixed $message, array $context = array() )`

`protected`

# `loadDestinations( type & $destinations, array $actives = NULL )`

#### Parameters

$destinations
  `type`
  $destinations
$actives
  `array`
  $actives array containing classes instanceof AbstractTlogDestination

Constants summary
`string` | `VAR_LEVEL` | `"tlog_level"` | #
`string` | `VAR_DESTINATIONS` | `"tlog_destinations"` | #
`string` | `VAR_PREFIXE` | `"tlog_prefix"` | #
`string` | `VAR_FILES` | `"tlog_files"` | #
`string` | `VAR_IP` | `"tlog_ip"` | #
`string` | `VAR_SHOW_REDIRECT` | `"tlog_show_redirect"` | #
`integer` | `DEBUG` | `100` | #
`integer` | `INFO` | `200` | #
`integer` | `NOTICE` | `300` | #
`integer` | `WARNING` | `400` | #
`integer` | `ERROR` | `500` | #
`integer` | `CRITICAL` | `600` | #
`integer` | `ALERT` | `700` | #
`integer` | `EMERGENCY` | `800` | #
`integer` | `MUET` | `PHP_INT_MAX` | #
`string` | `DEFAULT_LEVEL` | ``Thelia\Log\Tlog::DEBUG`` | #
`string` | `DEFAUT_DESTINATIONS` | `"Thelia\Log\Destination\TlogDestinationFile"` | #
`string` | `DEFAUT_PREFIXE` | `"#NUM: #NIVEAU [#FICHIER:#FONCTION()] {#LIGNE} #DATE #HEURE: "` | #
`string` | `DEFAUT_FILES` | `"*"` | #
`string` | `DEFAUT_IP` | `""` | #
`integer` | `DEFAUT_SHOW_REDIRECT` | `0` | #

Properties summary
`protected array` | $levels | `array( 100 => "DEBUG", 200 => "INFO", 300 => "NOTICE", 400 => "WARNING", 500 => "ERROR", 600 => "CRITICAL", 700 => "ALERT", 800 => "EMERGENCY" )` | #
`protected array` | $destinations | `array()` | # containing class of destination handler containing class of destination handler
`protected boolean` | $mode_back_office | `false` | #
`protected integer` | $level | ``Thelia\Log\Tlog::MUET`` | #
`protected string` | $prefixe | `""` | #
`protected array` | $files | `array()` | #
`protected boolean` | $all_files | `false` | #
`protected boolean` | $show_redirect | `false` | #
`protected static boolean` | $done | `false` | #
`public array` | $dir_destinations | `array()` | #