Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:logginevent [2007/10/11 07:27]
ravith
dev:logginevent [2009/07/06 20:36] (current)
Line 8: Line 8:
  
 **//''Description:''//** \\ **//''Description:''//** \\
- This unit is used for auditing/logging purposes in Sahana2. If modules need auditing features, it is a matter of passing values through the functions provided here. There are five levels of logging, namely+ This unit is used for auditing/logging purposes in Sahana2. If modules need auditing features, it is a matter of passing values through the functions provided here. 
  
-  * INFO   - Information log records. +<code php>shn_log_event( 
-  * DEBUG  - Debugging log records. +          $data_item_UUID=null, 
-  * WARN   - Warnings +          $comments, 
-  * ERROR  - Errors +          $details=null, 
-  * FATAL  - Fatal Errors+          $log_level=INFO
 +          $sensitivity_level=NOT_SENSITIVE, 
 +          $date_time=null, 
 +          $module=null, 
 +          $action=null, 
 +          array $extra_opts=null 
 +)</code>
  
 +Parameter description. \\
  
 +   * **''data_item_UUID''** - The UUID of a data item which the log record is related to. (optional)
 +   * **''comments''** - A breif log messsage. (required)
 +   * **''details''** - A detailed log message. (optional)
 +   * **''log_level''** - The log level
 +   * **''log_sensitivity''** - The sensitivity of this log message.
 +   * **''date_time''** - The date and time in the format returned by php date function - date("Y-m-d H:i:s")
 +   * **''module''** - The name of the module, if not specified (if null) it will be determined from $global['module']
 +   * **''action''** - The name of the action, if not specified (if null) it will be determined from $global['action']
 +   * **''extra_opts''** - any extra options as an associate array. This array will be parsed in to key-value pairs in the form of <key>value</key> and will be recorded as text. \\ eg. Longitude, Latitude, etc.
  
  
-Default is 1 and it logs basic informationlike date,time and action. Level 2 is comprehensive and detailed. Specially +**There are five levels of loggingnamely**
-level 3 is good for Sahana administrators and developers who wants to fine tune the applications. The logging level can +
-be altered in the Sahana main configuration file under /conf directory.+
  
-Currently **//''logger.inc''//** runs with both MySQL and PostgreSQL and it uses ADO-DB database abstraction layer to co +  * **INFO**   Information log records. 
-nnect to these databases.+  * **DEBUG**  - Debugging log records. 
 +  * **WARN**   - Warnings 
 +  * **ERROR**  - Errors 
 +  * **FATAL**  - Fatal Errors
  
 +**__//''These levels are defined as constants in lib_log.inc''//__** \\ \\
 +The log level defaults to **INFO**. \\
  
-**//''Desgin:''//** \\ +**There are nine levels of log sensitivity.**
-{{logger.png}} +
-\\ When a function calls a \u201clogger\u201d, it gets information like ''date,time,action,log level'' and ''module'' it +
-\u2019s being called from, as global variables. It also gets information such as userid and userlogid from the session. +
-Once it collects all the information, it determine the \u201clog level\u201d it has to use for auditing. Depending on th +
-is log level, it stores the values in the database.+
  
-            shn_db_insert_array($message);+   * **PERSON_SENSITIVE** 
 +   * **ORGANIZATION_SENSITIVE** 
 +   * **LEAGALLY_SENSITIVE** 
 +   * **NATIONAL_SECURITY_SENSITIVE** 
 +   * **SOCIALLY_SENSITIVE** 
 +   * **DISASTER_MITIGATION_SENSITIVE** 
 +   * **SYSTEM_SENSITIVE** 
 +   * **NOT_SENSITIVE** 
 +   * **UNCLASSIFIED**
  
-    $message: Log message+**__//''These levels are defined as constants in lib_log.inc''//__** \\ \\ 
 +The senisitvity level defaults to **NOT_SENSITIVE** \\
  
-The message can be chosen from predefined constants as specified in actions.inc, or custom messages can be passed as wel 
-l. 
  
 **//''Usage:''//** \\ **//''Usage:''//** \\
Line 64: Line 85:
 **//''Name:''//** debug.inc **//''Name:''//** debug.inc
  
 +The default method of logging (to file or to database) can be configured in the sysconf.inc under $conf['default_logger']. \\The log messages will be printed as HTML if the configured logger cannot be created or not found. \\
 +A custom logger can be created by extending the class Logger and overriding the log_message() function.
  
-**//''Synopsis:''//** debug($message) +<code php> 
- +log_message( 
-**//''Description:''//** \\ +          $data_item_UUID=null, 
- Handles Debug messages of Sahana. Especially meant for developers of the systemto be used at development time. Echos +          $comments, 
-debug messages to either screen or to a file. Can be updated through the configuration file.+          $details=null, 
 +          $log_level
 +          $sensitivity_level, 
 +          $datetime, 
 +          $module, 
 +          $action, 
 +          $ext_opt_str 
 +
 +</code>
  
 **//''Usage:''//** \\ **//''Usage:''//** \\
- include inc/lib_logger/debug.inc +The logging API **MUST** be used in the following and similar instances, additionally the module developer is free to use it else where.\\ 
- + \\ 
-  debug($message); +  * When a write commit is made to the database 
- +  * On a configuration change 
-where message is the custom message passed +  * On important event in the business logic of the module 
- +  * On an error 
-thus, message of the form: +  * On a security violation or suspicious action
- DEBUG: <date><time><message> is echoed. +
  
 +The log messages should be recorded with the appropriate logging level, and sensitivity level, to make event audit more efficient.
 \\ \\
 **//''Author:''//** \\ **//''Author:''//** \\
-//Pradeeper// and //Mifan// of Sahana core team.+//Ravith Botejue.//

Navigation
QR Code
QR Code dev:logginevent (generated for current page)