Contentserv PHP API

CSLog
in package

Tags

Table of Contents

LEVEL_MAXIMUM  = 10
LEVEL_MINIMUM  = 1
LOG_FILE_TYPE_DEBUG  = 'DEBUG'
LOG_FILE_TYPE_ERROR  = 'ERROR'
LOG_FILE_TYPE_INFO  = 'INFO'
LOG_FILE_TYPE_PERFORMANCE  = 'PERFORMANCE'
LOG_FILE_TYPE_WARNING  = 'WARNING'
LOG_STATUS_DEBUG  = 8
LOG_STATUS_DISABLED  = 0
Log status Handled as bitwise values to allow combined usage
LOG_STATUS_ERROR  = 1
LOG_STATUS_INFO  = 4
LOG_STATUS_PERFORMANCE  = 16
LOG_STATUS_WARNING  = 2
TYPE_CURL  = 7
TYPE_DELETION  = 8
TYPE_DEPRECATION  = 5
TYPE_ERROR  = 2
TYPE_EVENT  = 4
TYPE_MAIL  = 3
TYPE_NOTE  = 0
TYPE_PROCESS  = 6
TYPE_WARNING  = 1
addLogEntry()  : void
Adds and converts the log entry API object to the log entry record to store it afterwards in the database.
deleteLogEntry()  : bool
Deletes a log entry for a given log entry id.
deleteTableBySize()  : bool
Deletes given Record by size limit.
deleteTableOlderThanDays()  : bool
Deletes the Record table filtered by Days.
getLabelForRecordName()  : string
Returns the 'TableLabel' of any table name.
getLabels()  : array<string|int, mixed>
Returns labels from all available log tables.
getLogEntry()  : CSSystemLogEntry
Returns the log entry API object.
getNames()  : array<string|int, mixed>
Returns Names (class name) of all known Log records.
getTablesBySizeLimit()  : array<string|int, mixed>
Returns an array with all tables which exceed the size limit.
getTableSize()  : int
Returns the table size for any table name given.
getTableTimeFieldNameForRecordName()  : string
Returns the TimeFieldName of any table.
isLogEnabledForLogType()  : bool
Checks whether the log is enabled for a given log type.
logToFile()  : void
Write log entry in log file, using logging format standard
optimizeTable()  : bool
Optimizes the specified database table.
throwError()  : mixed
Throws an CSLogException.

Constants

LEVEL_MAXIMUM

public mixed LEVEL_MAXIMUM = 10
Tags

LEVEL_MINIMUM

public mixed LEVEL_MINIMUM = 1
Tags

LOG_FILE_TYPE_DEBUG

public mixed LOG_FILE_TYPE_DEBUG = 'DEBUG'
Tags

LOG_FILE_TYPE_ERROR

public mixed LOG_FILE_TYPE_ERROR = 'ERROR'
Tags

LOG_FILE_TYPE_INFO

public mixed LOG_FILE_TYPE_INFO = 'INFO'
Tags

LOG_FILE_TYPE_PERFORMANCE

public mixed LOG_FILE_TYPE_PERFORMANCE = 'PERFORMANCE'
Tags

LOG_FILE_TYPE_WARNING

public mixed LOG_FILE_TYPE_WARNING = 'WARNING'
Tags

LOG_STATUS_DEBUG

public mixed LOG_STATUS_DEBUG = 8
Tags

LOG_STATUS_DISABLED

Log status Handled as bitwise values to allow combined usage

public mixed LOG_STATUS_DISABLED = 0
Tags

LOG_STATUS_ERROR

public mixed LOG_STATUS_ERROR = 1
Tags

LOG_STATUS_INFO

public mixed LOG_STATUS_INFO = 4
Tags

LOG_STATUS_PERFORMANCE

public mixed LOG_STATUS_PERFORMANCE = 16
Tags

LOG_STATUS_WARNING

public mixed LOG_STATUS_WARNING = 2
Tags

TYPE_CURL

public mixed TYPE_CURL = 7
Tags

TYPE_DELETION

public mixed TYPE_DELETION = 8
Tags

TYPE_DEPRECATION

public mixed TYPE_DEPRECATION = 5
Tags

TYPE_ERROR

public mixed TYPE_ERROR = 2
Tags

TYPE_EVENT

public mixed TYPE_EVENT = 4
Tags

TYPE_MAIL

public mixed TYPE_MAIL = 3
Tags

TYPE_NOTE

public mixed TYPE_NOTE = 0
Tags

TYPE_PROCESS

public mixed TYPE_PROCESS = 6
Tags

TYPE_WARNING

public mixed TYPE_WARNING = 1
Tags

Methods

deleteLogEntry()

Deletes a log entry for a given log entry id.

public static deleteLogEntry(int $iLogEntryId) : bool
Parameters
$iLogEntryId : int

The log entry id which should be deleted.

Tags
throws
CSLogException
Return values
bool

whether it was successful

deleteTableBySize()

Deletes given Record by size limit.

public static deleteTableBySize(string $iLimitInBytes, string $sRecordName) : bool
Parameters
$iLimitInBytes : string
$sRecordName : string
Tags
Return values
bool

deleteTableOlderThanDays()

Deletes the Record table filtered by Days.

public static deleteTableOlderThanDays(int $iDays, string $sLogTableRecordName[, bool $bOptimizeTable = true ]) : bool
Parameters
$iDays : int
$sLogTableRecordName : string
$bOptimizeTable : bool = true

Defines whether an "optimize table" call should be executed after data has been deleted.

Tags
Return values
bool

getLabelForRecordName()

Returns the 'TableLabel' of any table name.

public static getLabelForRecordName(string $sLogRecordName) : string
Parameters
$sLogRecordName : string
Tags
Return values
string

with table label

getLabels()

Returns labels from all available log tables.

public static getLabels() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

containing labels

getLogEntry()

Returns the log entry API object.

public static getLogEntry([mixed $mLogEntryRecordOrId = null ]) : CSSystemLogEntry
Parameters
$mLogEntryRecordOrId : mixed = null
Tags
Return values
CSSystemLogEntry

getNames()

Returns Names (class name) of all known Log records.

public static getNames() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

getTablesBySizeLimit()

Returns an array with all tables which exceed the size limit.

public static getTablesBySizeLimit(int $iLimitInBytes, array<string|int, mixed> $aLogTableRecordNames) : array<string|int, mixed>
Parameters
$iLimitInBytes : int
$aLogTableRecordNames : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

containing table names

getTableSize()

Returns the table size for any table name given.

public static getTableSize(string $sDatabaseName) : int
Parameters
$sDatabaseName : string
Tags
Return values
int

$iSum containing the table size

getTableTimeFieldNameForRecordName()

Returns the TimeFieldName of any table.

public static getTableTimeFieldNameForRecordName(string $sLogRecordName) : string
Parameters
$sLogRecordName : string
Tags
Return values
string

TimeFieldName

isLogEnabledForLogType()

Checks whether the log is enabled for a given log type.

public static isLogEnabledForLogType(string $sLogType) : bool
Parameters
$sLogType : string

One of the values defined in the constant LOG_FILE_TYPES

Tags
Return values
bool

Whether the log is enabled for the given log type.

logToFile()

Write log entry in log file, using logging format standard

public static logToFile(string $sLogType, string $sComponent, string $sEvent, string $sStatus, string $sMessage[, array<string|int, mixed> $aDetails = array() ]) : void
Parameters
$sLogType : string

Log type, required to be one of the values defined in the constant LOG_FILE_TYPES

$sComponent : string

Service component, required to be one of the values defined via Service Catalog (Components)

$sEvent : string

Event to log, required to be one of the values defined via Service Catalog (Events)

$sStatus : string

Event status to log, required to be one of the values defined via Service Catalog (Events Status)

$sMessage : string

Log message content

$aDetails : array<string|int, mixed> = array()

Optional details of log entry, e.g., login failed details (username, authentication type, etc.)

Tags
throws
CSException
Return values
void

optimizeTable()

Optimizes the specified database table.

public static optimizeTable(string $sLogTableRecordName) : bool
Parameters
$sLogTableRecordName : string
Tags
Return values
bool

If action could be executed successfully.

throwError()

Throws an CSLogException.

public static throwError(mixed $mException, int $iCode[, bool $bForceAlert = false ]) : mixed
Parameters
$mException : mixed

A CSLogException object or the exception message.

$iCode : int

The error code.

$bForceAlert : bool = false

The flag to force an alert.

Tags
throws
CSLogException
see
CSLogException

constans for the error codes.

Return values
mixed

        

Search results