Log

Save data to log stat

Add information to Log request feedback:

Log::addMessage('This text is added to request data');

Add new split time to request timeline:

Log::addTime('Something is done now');

Add new time with inner duration. Time can overlap with another time.

$Time = Log::addTime('Time name');
// Code...
$Time->addMessage('Additional message');
$Time->addBacktrace(); // Add function call trace
// Code...
$Time->stop('Additional end message');

Add new lap time to counter. Counts number of loops and total time.

function MyFunction(){
    // Code1 ...
    $Counter = Log::getCounter('Counter name');
    // Code2 ...
    $Counter->stop();
    // Code3 ...
}

Log

Function return  Description
Log::setType($type)  -  Set request type: Ajax, view, mobile...
Log::setView($route)  -  Set route for requestt view.
Log::setValue($value) - Set request view main value (page id etc.)
Log::setMethod($method) - Set request method (GET, POST ...) See: getMethodCodes()
Log::setStatus($status) - Set request method (400,200...) See: getStatusCodes()
Log::addMessage($string) - Text to be added in request response info.
TIMER
Log::addTime($name)  LogTime Create new time.
Log::startTime($name[,$message])  LogTime Create new time.
Log::stopTime([$name,$message])  LogTime Stop last time, or time by name
Log::addError($name)  LogTime Create new time. set type = error
Log::addWarning($name)  LogTime Create new time. set type = warning
Log::addLastError($name) LogTime Add last PHP error message to log data.
COUNTER
Log::addCounter($name[,$message]) LogCounter Create new counter. Multiple counters are grouped by name.
Log::startCounter($name[,$message])  LogCounter Alias to addCounter()
Log::stopCounter($message) - Stop counter by name
SQL
Log::addSql($name[,$message])  LogSql Create new sql -log.
USER
Log::setUser($id) - Set request user id.
Log::setUserName($name) - Set request user name.
Log::setUserType($type) - Set user type: root, admin, user, global.
ACCOUNT
Log::setAccount($id) - Set request account.
Log::setAccountName($name) - Set request account name.
Log::getAccount() int Set request account Id.
TIME INFO
Log::getTimestamp() int Get current timestamp
Log::getStartTime()  int Request start time
Log::getTime() int  Get secs from request start.
MEMORY
Log::getMemory($update) float Current mem usage, in bytes. $update = true, Save current mem to cache. Default: true.
Log::getMemoryUsage() string Current mem usage, in Megabytes with unit.
Log::getMemoryChange() string Mem usage change since from last cached value. Save new cache value. Megabytes with unit.
INFO
Log::isOn() bool Return TRUE if saves log to DB is set on.
getStatusCodes()  array  List of status codes: code=>Title
getMethodCodes() array List of Methde: code=>Title

LogTime

New LogTime can be created with Log::newTime(name) -method.

Function return  Description
setName($txt) LogTime Time title text
setSource($txt) LogTime Set Time Source. Default: user
setType($txt) LogTime Set Time Type. message, warning, error, deprecated
addMessage($txt) LogTime Additional info text
stop($message) LogTime Set secs
getStart() float Return time from request start
getSecs() float Return time duration
addBacktrace() this Add PHP function calls trace

LogCounter

New LogCounter can be created with Log::startCounter(name) -method.

Function return  Description
setName(txt) string Time title text
addMessage(txt) string Additional info text
stop([txt]) this Add secs to total time. Optionally add message text.

LogSql

New LogSql can be created with Log::addSql($name[,$message]) -method.

Function return  Description
setTitle(txt) this Time title text
addDescription(txt) this Additional info text
addMEssage(txt) this Additional info text
setLogMin($sec) this If request time >. sec, saves Log.
setQuery($count) this SQL query.
setVariables($array) this SQL query variables.
setRows($count) this How many rows was found
stop([txt]) this Save log.