PHP Class Habari\EventLog

Inheritance: extends ArrayObject
显示文件 Open project: habari/system Class Usage Examples

Protected Properties

Property Type Description
$get_param_cache

Public Methods

Method Description
__get ( string $name ) : boolean Returns properties of a EventLog object.
get ( array $paramarray = [] ) : array Returns a LogEntry or EventLog array based on supplied parameters.
get_module ( null $module = null, integer $level = 2 ) : string Get the module in which the logged code was executed
log ( string $message, string $severity = 'info', string $type = 'default', string $module = null, mixed $data = null ) : object Write an entry to the event log.
purge ( )
register_type ( string $type = 'default', string $module = null ) Adds a logging type to the lookup table
trim ( ) * Trim the EventLog down to the defined number of days to prevent it getting massively large.
unregister_type ( string $type = 'default', string $module = null ) Removes a logging type from the lookup table

Method Details

__get() public method

This is the function that returns information about the set of log entries that was requested. This function should offer property names that are identical to properties of instances of the URL class. A call to EventLog::get() without parameters should return mostly the same property values as the global $url object for the request. The difference would occur when the data returned doesn't necessarily match the request, such as when several log entries are requested, but only one is available to return.
public __get ( string $name ) : boolean
$name string The name of the property to return.
return boolean

get() public static method

By default,fetch as many entries as pagination allows and order them in a descending fashion based on timestamp.
public static get ( array $paramarray = [] ) : array
$paramarray array An associated array of parameters, or a querystring The following keys are supported: - id => an entry id or array of post ids - user_id => id of the logged in user for which to return entries - severity => severity level for which to return entries - type_id => the numeric id or array of ids for the type of entries for which which to return entries - module => a name or array of names of modules for which to return entries - type => a single type name or array of type names for which to return entries - ip => the IP number for which to return entries - criteria => a literal search string to match entry message content or a special search - day => a day of entry creation, ignored if month and year are not specified - month => a month of entry creation, ignored if year isn't specified - year => a year of entry creation - orderby => how to order the returned entries - fetch_fn => the function used to fetch data, one of 'get_results', 'get_row', 'get_value' - count => return the number of entries that would be returned by this request - month_cts => return the number of entries created in each month - nolimit => do not implicitly set limit - limit => the maximum number of entries to return, implicitly set for many queries - index => - offset => amount by which to offset returned entries, used in conjunction with limit - where => manipulate the generated WHERE clause - return_data => set to return the data associated with the entry
return array An array of LogEntry objects, or a single LogEntry object, depending on request

get_module() public static method

Get the module in which the logged code was executed
public static get_module ( null $module = null, integer $level = 2 ) : string
$module null
$level integer How many backtrace calls to go back through the trace
return string The classname or .php module in which the log code was called.

log() public static method

Write an entry to the event log.
public static log ( string $message, string $severity = 'info', string $type = 'default', string $module = null, mixed $data = null ) : object
$message string The message
$severity string The severity
$type string The type
$module string The module
$data mixed The data
return object LogEntry The inserted LogEntry object

purge() public static method

public static purge ( )

register_type() public static method

Adds a logging type to the lookup table
public static register_type ( string $type = 'default', string $module = null )
$type string The type of the error
$module string The module of the error

trim() public static method

* Trim the EventLog down to the defined number of days to prevent it getting massively large.
public static trim ( )

unregister_type() public static method

Removes a logging type from the lookup table
public static unregister_type ( string $type = 'default', string $module = null )
$type string The type of the error
$module string The module of the error

Property Details

$get_param_cache protected_oe property

protected $get_param_cache