Elgg  Version master
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Elgg\Logger Class Reference

Logger. More...

Inheritance diagram for Elgg\Logger:

Public Member Functions

 setLevel (string $level=LogLevel::EMERGENCY)
 Set the logging level. More...
 
 getLevel (bool $severity=true)
 Get the current logging level severity. More...
 
 isLoggable (string $level)
 Check if a level is loggable under current logging level. More...
 
 log ($level, $message, array $context=[])
 {} More...
 
 emergency ($message, array $context=[])
 {} More...
 
 alert ($message, array $context=[])
 {} More...
 
 critical ($message, array $context=[])
 {} More...
 
 error ($message, array $context=[])
 {} More...
 
 warning ($message, array $context=[])
 {} More...
 
 notice ($message, array $context=[])
 {} More...
 
 info ($message, array $context=[])
 {} More...
 
 debug ($message, array $context=[])
 {} More...
 
 disable ()
 Temporarily disable logging and capture logs (before tests) More...
 
 enable ()
 Restore logging and get record of log calls (after tests) More...
 

Static Public Member Functions

static factory (?InputInterface $input=null, ?OutputInterface $output=null)
 Build a new logger. More...
 

Public Attributes

const CHANNEL = 'ELGG'
 
const OFF = 600
 

Protected Member Functions

 assertLevel (string $level)
 Assert the given level. More...
 

Protected Attributes

string $level = LogLevel::EMERGENCY
 
array $disabled_stack = []
 

Static Protected Attributes

static array $elgg_levels
 

Detailed Description

Logger.

Use elgg()->logger

Definition at line 27 of file Logger.php.

Member Function Documentation

◆ alert()

Elgg\Logger::alert (   $message,
array  $context = [] 
)

{}

Definition at line 227 of file Logger.php.

◆ assertLevel()

Elgg\Logger::assertLevel ( string  $level)
protected

Assert the given level.

Parameters
string$levelthe level to assert
Returns
void
Exceptions
InvalidArgumentException

Definition at line 134 of file Logger.php.

◆ critical()

Elgg\Logger::critical (   $message,
array  $context = [] 
)

{}

Definition at line 234 of file Logger.php.

◆ debug()

Elgg\Logger::debug (   $message,
array  $context = [] 
)

{}

Definition at line 269 of file Logger.php.

◆ disable()

Elgg\Logger::disable ( )

Temporarily disable logging and capture logs (before tests)

Call disable() before your tests and enable() after. enable() will return a list of calls to log() (and helper methods) that were not acted upon.

Note
This behaves like a stack. You must call enable() for each disable() call.
Returns
void
See also
enable()

Definition at line 285 of file Logger.php.

◆ emergency()

Elgg\Logger::emergency (   $message,
array  $context = [] 
)

{}

Definition at line 220 of file Logger.php.

◆ enable()

Elgg\Logger::enable ( )

Restore logging and get record of log calls (after tests)

Returns
array
See also
disable()

Definition at line 296 of file Logger.php.

◆ error()

Elgg\Logger::error (   $message,
array  $context = [] 
)

{}

Definition at line 241 of file Logger.php.

◆ factory()

static Elgg\Logger::factory ( ?InputInterface  $input = null,
?OutputInterface  $output = null 
)
static

Build a new logger.

Parameters
null | InputInterface$inputConsole input
null | OutputInterface$outputConsole output
Returns
static

Definition at line 60 of file Logger.php.

◆ getLevel()

Elgg\Logger::getLevel ( bool  $severity = true)

Get the current logging level severity.

Parameters
bool$severityIf true, will return numeric representation of the logging level
Returns
int|string

Definition at line 163 of file Logger.php.

◆ info()

Elgg\Logger::info (   $message,
array  $context = [] 
)

{}

Definition at line 262 of file Logger.php.

◆ isLoggable()

Elgg\Logger::isLoggable ( string  $level)

Check if a level is loggable under current logging level.

Parameters
string$levelLevel name
Returns
bool
Exceptions
InvalidArgumentException

Definition at line 175 of file Logger.php.

◆ log()

Elgg\Logger::log (   $level,
  $message,
array  $context = [] 
)

{}

Exceptions
InvalidArgumentException

Definition at line 186 of file Logger.php.

◆ notice()

Elgg\Logger::notice (   $message,
array  $context = [] 
)

{}

Definition at line 255 of file Logger.php.

◆ setLevel()

Elgg\Logger::setLevel ( string  $level = LogLevel::EMERGENCY)

Set the logging level.

Parameters
string$levelLevel
Returns
void
Exceptions
InvalidArgumentException

Definition at line 149 of file Logger.php.

◆ warning()

Elgg\Logger::warning (   $message,
array  $context = [] 
)

{}

Definition at line 248 of file Logger.php.

Member Data Documentation

◆ $disabled_stack

array Elgg\Logger::$disabled_stack = []
protected

Definition at line 50 of file Logger.php.

◆ $elgg_levels

array Elgg\Logger::$elgg_levels
staticprotected
Initial value:
= [
100 => LogLevel::DEBUG,
200 => LogLevel::INFO,
250 => LogLevel::NOTICE,
300 => LogLevel::WARNING,
400 => LogLevel::ERROR,
500 => LogLevel::CRITICAL,
550 => LogLevel::ALERT,
600 => LogLevel::EMERGENCY,
]

Definition at line 37 of file Logger.php.

◆ $level

string Elgg\Logger::$level = LogLevel::EMERGENCY
protected

Definition at line 48 of file Logger.php.

◆ CHANNEL

const Elgg\Logger::CHANNEL = 'ELGG'

Definition at line 29 of file Logger.php.

◆ OFF

const Elgg\Logger::OFF = 600

Definition at line 31 of file Logger.php.


The documentation for this class was generated from the following file: