From Freeside
< Freeside:4:Documentation:Developer‎ | FS
Revision as of 08:24, 18 November 2015 by Jeremyd (talk | contribs) (Edit via perl MediaWiki framework (1.13))

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


FS::log - Object methods for log records


 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;


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


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.
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.
Returns the context for this log entry, as an array, from least to most specific.


search HASHREF
Returns a qsearch hash expression to search for parameters specified in HASHREF. Valid parameters are:
; 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.



FS::Record, schema.html from the base documentation.