AloFramework Logger
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • AloFramework
    • Log
  • None
  • PHP
  • Psr
    • Log

Classes

  • Log

Exceptions

  • LogException

Class Log

AloFramework logger

Psr\Log\LogLevel
Extended byAloFramework\Log\LogimplementsPsr\Log\LoggerInterfaceusesPsr\Log\LoggerTrait
Namespace:AloFramework\Log
Author:Art <a.molcanovas@gmail.com>
Located atsrc/class/AloFramework/Log/Log.php

Methods summary

public
#__construct(string$logLevel=Psr\Log\LogLevel::DEBUG,string$label= ALO_LOG_LABEL,string$savePath= ALO_LOG_SAVE_PATH)

Constructor

Constructor

Parameters

$logLevel
string
$logLevel Minimum log level to log. See class constants.
$label
string
$label Log label, e.g. if you specify 'System' log entries will be prepended with SYSTEM
$savePath
string
$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>
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>
publicAloFramework\Log\Log|string
#savePath(string|null$path=null)

Gets or sets the log file path

Gets or sets the log file path

Parameters

$path
string|null
$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
Psr\Log\InvalidArgumentException
When the path isn't a valid string

Author

Art <a.molcanovas@gmail.com>
publicAloFramework\Log\Log|string
#logLabel(string|null$set=null)

Gets or sets the log label

Gets or sets the log label

Parameters

$set
string|null
$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>
publicAloFramework\Log\Log|string
#level(string|null$set=null)

Gets or sets the log level

Gets or sets the log level

Parameters

$set
string|null
$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
string
$level The message's log level
$message
string
$message The message
$context
array
$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

Implementation of

Psr\Log\LoggerInterface::log()
private boolean
#doWrite(string$level,string$message)

Performs the actual log operation

Performs the actual log operation

Parameters

$level
string
$level Log level
$message
string
$message Raw message

Returns

boolean

Author

Art <a.molcanovas@gmail.com>
protected static string
#replaceContext(string$message,array$context= [])

Replaces the placeholders in the message

Replaces the placeholders in the message

Parameters

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

Returns

string

Methods inherited fromPsr\Log\LoggerInterface

alert(),critical(),debug(),emergency(),error(),info(),notice(),warning()

Methods used fromPsr\Log\LoggerTrait

alert(),critical(),debug(),emergency(),error(),info(),notice(),warning()

Magic methods summary

Constants summary

Constants inherited fromPsr\Log\LogLevel

ALERT,CRITICAL,DEBUG,EMERGENCY,ERROR,INFO,NOTICE,WARNING

Properties summary

protected string$label
#

Log identifier

Log identifier

protected string$savePath
#

Where the logs are stored

Where the logs are stored

protected string$level
#

Log level set

Log level set

private static string$SEPARATOR
#

Log element separator

Log element separator

private static array$priority
#

Log levels and their priorities

Log levels and their priorities

AloFramework Logger API documentation generated byApiGen 2.8.0