Documentation

Database extends AbstractWriter
in package

Database log writer class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.0.0

Table of Contents

Properties

$db  : AbstractAdapter|null
DB adapter
$limit  : int|null
Log limit
$table  : string
Table

Methods

__construct()  : mixed
Constructor
getContext()  : string
Get context for log
getDb()  : AbstractAdapter
Get DB
getLogLimit()  : int|null
Get log limit
getTable()  : string
Get table
hasLogLimit()  : bool
Has log limit
isWithinLogLimit()  : bool
Check if a log level is within the set log level limit
setLogLimit()  : AbstractWriter
Set log limit
setTable()  : Database
Set table
writeLog()  : Database
Write to the log
createTable()  : void
Create table in database

Properties

$table

Table

protected string $table = 'pop_log'

Methods

__construct()

Constructor

public __construct(AbstractAdapter $db[, string $table = 'pop_log' ]) : mixed

Instantiate the DB writer object

The DB table requires the following fields at a minimum: timestamp DATETIME level INT name VARCHAR message TEXT, VARCHAR, etc. context TEXT, VARCHAR, etc.

Parameters
$db : AbstractAdapter
$table : string = 'pop_log'

getContext()

Get context for log

public getContext([array<string|int, mixed> $context = [] ]) : string
Parameters
$context : array<string|int, mixed> = []
Return values
string

getLogLimit()

Get log limit

public getLogLimit() : int|null
Return values
int|null

getTable()

Get table

public getTable() : string
Return values
string

hasLogLimit()

Has log limit

public hasLogLimit() : bool
Return values
bool

isWithinLogLimit()

Check if a log level is within the set log level limit

public isWithinLogLimit(int $level) : bool
Parameters
$level : int
Return values
bool

setTable()

Set table

public setTable(string $table) : Database
Parameters
$table : string
Tags
parma

string $table

Return values
Database

writeLog()

Write to the log

public writeLog(mixed $level, string $message[, array<string|int, mixed> $context = [] ]) : Database
Parameters
$level : mixed
$message : string
$context : array<string|int, mixed> = []
Return values
Database

createTable()

Create table in database

protected createTable() : void

        
On this page

Search results