Freeside:3:Documentation:Developer/FS/log
From Freeside
NAME
FS::log - Object methods for log records
SYNOPSIS
use FS::log; $record = new FS::log \%hash; $record = new FS::log { 'column' => 'value' }; $error = $record->insert; $error = $new_record->replace($old_record); $error = $record->delete; $error = $record->check;
DESCRIPTION
An FS::log object represents a log entry. FS::log inherits from FS::Record. The following fields are currently supported:
- lognum - primary key; _date - Unix timestamp; agentnum - FS::agent to which the log pertains. If it involves a specific customer, package, service, invoice, or other agent-specific object, this will be set to that agentnum.; tablename - table name to which the log pertains, if any.; tablenum - foreign key to that table.; level - log level: 'debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency'.; message - contents of the log entry
METHODS
- new HASHREF
- Creates a new log entry. Use FS::Log instead of calling this directly, please.
- insert [ CONTEXT... ]
- Adds this record to the database. If there is an error, returns the error, otherwise returns false.
- CONTEXT may be a list of context tags to attach to this record.
- check
- Checks all fields to make sure this is a valid example. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
- context
- Returns the context for this log entry, as an array, from least to most specific.
CLASS METHODS
- search HASHREF
- Returns a qsearch hash expression to search for parameters specified in HASHREF. Valid parameters are:
- agentnum
- ; date - arrayref of start and end date:; level - either a specific level, or an arrayref of min and max level:; context - a context string that the log entry must have. This may change in the future to allow searching for combinations of context strings.:; object - any database object, to find log entries related to it.:; tablename, tablenum - alternate way of specifying 'object'.:; custnum - a customer number, to find log entries related to the customer or any of their subordinate objects (invoices, packages, etc.).:; message - a text string to search in messages. The search will be a case-insensitive LIKE with % appended at both ends.
BUGS
SEE ALSO
FS::Record, schema.html from the base documentation.