コード例 #1
0
ファイル: logging.lib.php プロジェクト: jijkoun/ssscrape
 /**
  * Initializes the AnewtLog module.
  *
  * \param $setup_default_handler
  *   Whether to setup a default handler. If true, a new
  *   AnewtLogHandlerDefault instance with default level filtering will be
  *   initialized. This parameter defaults to false, which means a log
  *   handler needs to be added manually before using the logging facilities.
  */
 static function init($setup_default_handler = false)
 {
     global $anewt_logging_handlers;
     global $anewt_logging_domain_stack;
     assert('is_bool($setup_default_handler)');
     $anewt_logging_handlers = array();
     $anewt_logging_domain_stack = array();
     /* Setup default handler */
     if ($setup_default_handler) {
         $handler = new AnewtLogHandlerDefault();
         AnewtLog::add_handler($handler);
     }
 }
コード例 #2
0
ファイル: logging.test.php プロジェクト: jijkoun/ssscrape
<?php

error_reporting(E_ALL | E_STRICT);
require_once '../anewt.lib.php';
anewt_include('logging');
AnewtLog::init(false);
AnewtLog::add_handler(new AnewtLogHandlerDefault());
AnewtLog::add_handler(new AnewtLogHandlerFile('test.log'));
AnewtLog::add_handler(new AnewtLogHandlerFile('test-debug.log'), ANEWT_LOG_LEVEL_DEBUG);
AnewtLog::set_domain('a');
AnewtLog::error('An error occured.');
AnewtLog::set_domain('b');
AnewtLog::error('Error number %d', 3);
AnewtLog::reset_domain();
AnewtLog::debug('Debugging message: %d: %s', 4, 'dbg');
AnewtLog::set_domain('c');
AnewtLog::warning('This is a warning message without arguments');
AnewtLog::reset_domain();
AnewtLog::warning('This is a warning message: %d: %s', 2, 'test1');
AnewtLog::reset_domain();
AnewtLog::warning('This is a warning message: %d: %s', array(2, 'test2'));
AnewtLog::warning('This is warning with format characters but no values, %s %s %s');