Overview

Namespaces

  • AloFramework
    • Log
  • PHP

Classes

  • Log

Exceptions

  • LogException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Class Log

AloFramework logger

Psr\Log\LogLevel
Extended by AloFramework\Log\Log implements Psr\Log\LoggerInterface uses Psr\Log\LoggerTrait (not available)
Namespace: AloFramework\Log
Author: Art a.molcanovas@gmail.com
Uses: LoggerTrait
Located at class/Log.php
Methods summary
public
# __construct( string $logLevel = self::DEBUG, string $label = ALO_LOG_LABEL, string $savePath = ALO_LOG_SAVE_PATH )

Constructor

Constructor

Parameters

$logLevel
Minimum log level to log. See class constants.
$label
Log label, e.g. if you specify 'System' log entries will be prepended with SYSTEM
$savePath

The file to save the logs in. If omitted, the logs directory in this package will be used with the filenames being today's date in YYYY-mm-dd format.

Throws

AloFramework\Log\LogException
When a save path is specified, but the directory does not exist
Psr\Log\InvalidArgumentException
When $log isn't scalar or $logLevel is invalid

Author

Art a.molcanovas@gmail.com

Uses

AloFramework\Log\Log::logLabel()
AloFramework\Log\Log::$level
AloFramework\Log\Log::$savePath
public string
# __toString( )

Returns a string representation of the class

Returns a string representation of the class

Returns

string

Author

Art a.molcanovas@gmail.com

Uses

VarDumper::dump()
public AloFramework\Log\Log|string
# savePath( string|null $path = null )

Gets or sets the log file path

Gets or sets the log file path

Parameters

$path
Omit if using as a getter; The path to the log file otherwise

Returns

AloFramework\Log\Log|string

Throws

AloFramework\Log\LogException
When the directory doesn't exist or is not writeable
Psr\Log\InvalidArgumentException
When the path isn't a valid string

Author

Art a.molcanovas@gmail.com
public AloFramework\Log\Log|string
# logLabel( string|null $set = null )

Gets or sets the log label

Gets or sets the log label

Parameters

$set
Omit if using as a getter, the new log label if using as a setter.

Returns

AloFramework\Log\Log|string

Throws

Psr\Log\InvalidArgumentException
If attempting to set an invalid log level

Author

Art a.molcanovas@gmail.com

Used by

AloFramework\Log\Log::__construct()
public AloFramework\Log\Log|string
# level( string|null $set = null )

Gets or sets the log level

Gets or sets the log level

Parameters

$set

Omit if using as a getter, the log level if using as a setter - see class constants or refer to the PSR-3 standards.

Returns

AloFramework\Log\Log|string

Throws

Psr\Log\InvalidArgumentException
If attempting to set an invalid log level

Author

Art a.molcanovas@gmail.com
public boolean
# log( string $level, string $message, array $context = [] )

Logs with an arbitrary level.

Logs with an arbitrary level.

Parameters

$level
The message's log level
$message
The message
$context
The message context/placeholder asociative array

Returns

boolean
Whether the message has been written

Throws

Psr\Log\InvalidArgumentException
When the log level is invalid

Uses

Log::doWrite()
Log::replaceContect()
protected static string
# replaceContext( string $message, array $context = [] )

Replaces the placeholders in the message

Replaces the placeholders in the message

Parameters

$message
The raw message
$context
The context/placeholder assoc array

Returns

string
Properties summary
protected string $label

Log identifier

Log identifier

#
protected string $savePath

Where the logs are stored

Where the logs are stored

Used by

AloFramework\Log\Log::__construct()
#
protected string $level

Log level set

Log level set

Used by

AloFramework\Log\Log::__construct()
#
AloFramework Log 1.0 API API documentation generated by ApiGen