Menu

## Logger extends AbstractLogger
in package
implements LoggerInterface

Logger.php : 23

Kotchasan Logger Class (PSR-3)

##### Tags

see
  https://www.kotchasan.com/

### Interfaces, Classes and Traits

LoggerInterface
  Describes a logger instance.

### Table of Contents

$instance : Singleton
  Singleton instance
$logLevels : array<string|int, mixed>
  Log Levels
$options : array<string|int, mixed>
  Log options
alert() : mixed
  Action must be taken immediately
create() : static
  Create a Logger instance (Singleton).
critical() : mixed
  Critical conditions
debug() : mixed
  Detailed debug information
emergency() : mixed
  System is unusable
error() : mixed
  Runtime errors that do not require immediate action but should typically be logged and monitored
info() : mixed
  Interesting events
log() : void
  Logs a message with an arbitrary level.
notice() : mixed
  Normal but significant events
warning() : mixed
  Exceptional occurrences that are not errors
__construct() : mixed
  Private constructor.

### Properties

#### $instance

Logger.php : 58

Singleton instance

`protected static Singleton $instance = null`

#### $logLevels

Logger.php : 30

Log Levels

`protected array<string|int, mixed> $logLevels = [PsrLogLogLevel::EMERGENCY => 0, PsrLogLogLevel::ALERT => 1, PsrLogLogLevel::CRITICAL => 2, PsrLogLogLevel::ERROR => 3, PsrLogLogLevel::WARNING => 4, PsrLogLogLevel::NOTICE => 5, PsrLogLogLevel::INFO => 6, PsrLogLogLevel::DEBUG => 7]`

#### $options

Logger.php : 46

Log options

`protected array<string|int, mixed> $options = ['dateFormat' => 'Y-m-d H:i:s', 'logFormat' => '[{datetime}] {level}: {message} {context}', 'logFilePath' => 'logs/', 'extension' => 'php']`

### Methods

#### alert()

AbstractLogger.php : 31

Action must be taken immediately

`public alert(string $message[, array<string|int, mixed> $context = [] ]) : mixed`

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

##### Parameters

$message : string
$context : array<string|int, mixed> = []

##### Return values

mixed —

#### create()

Logger.php : 67

Create a Logger instance (Singleton).

`public static create([array<string|int, mixed> $options = [] ]) : static`

##### Parameters

$options : array<string|int, mixed> = []

  Log options (optional).

##### Return values

static —

#### critical()

AbstractLogger.php : 44

Critical conditions

`public critical(string $message[, array<string|int, mixed> $context = [] ]) : mixed`

Example: Application component unavailable, unexpected exception

##### Parameters

$message : string
$context : array<string|int, mixed> = []

##### Return values

mixed —

#### debug()

AbstractLogger.php : 55

Detailed debug information

`public debug(string $message[, array<string|int, mixed> $context = [] ]) : mixed`

##### Parameters

$message : string
$context : array<string|int, mixed> = []

##### Return values

mixed —

#### emergency()

AbstractLogger.php : 66

System is unusable

`public emergency(string $message[, array<string|int, mixed> $context = [] ]) : mixed`

##### Parameters

$message : string
$context : array<string|int, mixed> = []

##### Return values

mixed —

#### error()

AbstractLogger.php : 78

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

`public error(string $message[, array<string|int, mixed> $context = [] ]) : mixed`

##### Parameters

$message : string
$context : array<string|int, mixed> = []

##### Return values

mixed —

#### info()

AbstractLogger.php : 91

Interesting events

`public info(string $message[, array<string|int, mixed> $context = [] ]) : mixed`

Example: User logs in, SQL logs

##### Parameters

$message : string
$context : array<string|int, mixed> = []

##### Return values

mixed —

#### log()

Logger.php : 85

Logs a message with an arbitrary level.

`public log(mixed $level, string $message[, array<string|int, mixed> $context = [] ]) : void`

##### Parameters

$level : mixed

  The log level.

$message : string

  The log message.

$context : array<string|int, mixed> = []

  The log context (optional).

##### Return values

void —

#### notice()

AbstractLogger.php : 111

Normal but significant events

`public notice(string $message[, array<string|int, mixed> $context = [] ]) : mixed`

##### Parameters

$message : string
$context : array<string|int, mixed> = []

##### Return values

mixed —

#### warning()

AbstractLogger.php : 125

Exceptional occurrences that are not errors

`public warning(string $message[, array<string|int, mixed> $context = [] ]) : mixed`

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

##### Parameters

$message : string
$context : array<string|int, mixed> = []

##### Return values

mixed —

#### __construct()

Logger.php : 141

Private constructor.

`private __construct(array<string|int, mixed> $options) : mixed`

##### Parameters

$options : array<string|int, mixed>

  Log options.

##### Return values

mixed —

## Search results