UNA
BxDolLogs Class Reference
Inheritance diagram for BxDolLogs:
BxDolFactory iBxDolFactoryObject

Public Member Functions

 getObjectName ()
 
 add ($mixed)
 
 get ($iLines=30, $sFilter='')
 
 isFilterAvail ()
 
 isGetAvail ()
 

Static Public Member Functions

static getObjectInstance ($sObject)
 

Protected Member Functions

 __construct ($aObject, $oLogsStorage)
 

Detailed Description

This class unifies the usage of logs.

Add record to sys_objects_logs table, like you are doing this for Comments or Voting objects:

  • object: your logs object name, usually it is in the following format - vendor prefix, underscore, module prefix;
  • module: module name
  • logs_storage: logs storage, supported storages:
    • Auto: log to the storage currently configured in settings
    • Folder: files in logs folder
    • PHPLog: php log
    • STDErr: standard error output, usually written to web server error log
  • title: translatable title
  • active: 0 or 1
  • class_name: user defined class name which is derived from BxDolLogs.
  • class_file: the location of the user defined class, leave it empty if class is located in system folders.

It's also possible to not add record to sys_objects_logs table, then it will use default settings for logging.

Example of usage

Log data to the logs object

if ($o = BxDolLogs::getObjectInstance('my_module_logs_object'))
$o->add($s);

or

bx_log('my_module_logs_object', $s);

Constructor & Destructor Documentation

◆ __construct()

BxDolLogs::__construct (   $aObject,
  $oLogsStorage 
)
protected

Constructor

Member Function Documentation

◆ add()

BxDolLogs::add (   $mixed)

Log to the current logs storage object

Parameters
$mixedstring or array to log
Returns
true on success or false on error

◆ get()

BxDolLogs::get (   $iLines = 30,
  $sFilter = '' 
)

Get logs from current logs storage

Parameters
$iLinesnumber of lines from the tail to return
$sFilterfilter lines by keyword
Returns
array of strings or false on error

◆ getObjectInstance()

static BxDolLogs::getObjectInstance (   $sObject)
static

Get logs object instance by object name

Parameters
$sObjectobject name
Returns
object instance or false on error

Implements iBxDolFactoryObject.

◆ getObjectName()

BxDolLogs::getObjectName ( )

Get current logs object name

◆ isFilterAvail()

BxDolLogs::isFilterAvail ( )

Check if filtering supported in get method

◆ isGetAvail()

BxDolLogs::isGetAvail ( )

Check if get method available


The documentation for this class was generated from the following file: