Alpha Framework 4.0.0 API Documentation

Logger
in package

Log class used for debug and exception logging.

Tags
since
1.0
author

John Collins dev@alphaframework.org

license

http://www.opensource.org/licenses/bsd-license.php The BSD License

copyright

Copyright (c) 2021, John Collins (founder of Alpha Framework). All rights reserved.

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:

* Redistributions of source code must retain the above
  copyright notice, this list of conditions and the
  following disclaimer.
* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the
  following disclaimer in the documentation and/or other
  materials provided with the distribution.
* Neither the name of the Alpha Framework nor the names
  of its contributors may be used to endorse or promote
  products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Table of Contents

Properties

$classname  : string
The name of the class that this Logger is logging for.
$debugClasses  : array<string|int, mixed>
An array of class names that will be logged at debug level, regardless of the global Logger::level setting.
$level  : string
The logging level applied accross the system. Valid options are DEBUG, INFO, WARN, ERROR, FATAL, and SQL.
$logProvider  : LogProviderFile
The log file the log entries will be saved to.
$request  : Request
A request object that will give us the IP, user-agent etc. of the client we are logging for.

Methods

__construct()  : mixed
The constructor.
action()  : void
Log an action carried out by a person to the ActionLog table.
debug()  : void
Log a DEBUG message.
error()  : void
Log an ERROR message.
fatal()  : void
Log a FATAL message.
info()  : void
Log an INFO message.
notifyAdmin()  : void
Notify the sys admin via email when a serious error occurs.
setLogProviderFile()  : void
Allows you to set the log file path to one other than the main application log.
sql()  : void
Log a SQL queries.
warn()  : void
Log a WARN message.

Properties

$classname

The name of the class that this Logger is logging for.

private string $classname
Tags
since
1.0

$debugClasses

An array of class names that will be logged at debug level, regardless of the global Logger::level setting.

private array<string|int, mixed> $debugClasses = array()
Tags
since
1.0

$level

The logging level applied accross the system. Valid options are DEBUG, INFO, WARN, ERROR, FATAL, and SQL.

private string $level
Tags
since
1.0

$logProvider

The log file the log entries will be saved to.

private LogProviderFile $logProvider
Tags
since
1.0

$request

A request object that will give us the IP, user-agent etc. of the client we are logging for.

private Request $request
Tags
since
2.0

Methods

__construct()

The constructor.

public __construct(string $classname) : mixed
Parameters
$classname : string
Tags
since
1.0

action()

Log an action carried out by a person to the ActionLog table.

public action(string $message) : void
Parameters
$message : string
Tags
since
1.1

debug()

Log a DEBUG message.

public debug(string $message) : void
Parameters
$message : string
Tags
since
1.0

error()

Log an ERROR message.

public error(string $message) : void
Parameters
$message : string
Tags
since
1.0

fatal()

Log a FATAL message.

public fatal(string $message) : void
Parameters
$message : string
Tags
since
1.0

info()

Log an INFO message.

public info(string $message) : void
Parameters
$message : string
Tags
since
1.0

notifyAdmin()

Notify the sys admin via email when a serious error occurs.

public notifyAdmin(string $message) : void
Parameters
$message : string
Tags
since
1.0
throws
MailNotSentException

setLogProviderFile()

Allows you to set the log file path to one other than the main application log.

public setLogProviderFile(string $filepath) : void
Parameters
$filepath : string
Tags
since
1.0

sql()

Log a SQL queries.

public sql(string $message) : void
Parameters
$message : string
Tags
since
1.1

warn()

Log a WARN message.

public warn(string $message) : void
Parameters
$message : string
Tags
since
1.0

        
On this page

Search results