本文整理汇总了PHP中Log::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::singleton方法的具体用法?PHP Log::singleton怎么用?PHP Log::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::singleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Creates a new instance of DirectoryBaker.
*/
public function __construct(IPieCrust $pieCrust, $bakeDir, array $parameters = array(), $logger = null)
{
$this->pieCrust = $pieCrust;
$this->tmpDir = $this->pieCrust->isCachingEnabled() ? $this->pieCrust->getCacheDir() . 'bake_t/' : rtrim(sys_get_temp_dir(), '/\\') . '/piecrust/bake_t/';
$this->bakeDir = rtrim(str_replace('\\', '/', $bakeDir), '/') . '/';
$this->parameters = array_merge(array('smart' => true, 'mounts' => array(), 'skip_patterns' => array(), 'force_patterns' => array(), 'processors' => array('copy')), $parameters);
if ($logger == null) {
$logger = \Log::singleton('null', '', '');
}
$this->logger = $logger;
// Add a special mount point for the theme directory, if any.
if ($this->pieCrust->getThemeDir()) {
$this->parameters['mounts']['theme'] = $this->pieCrust->getThemeDir();
}
// Validate skip patterns.
$this->parameters['skip_patterns'] = self::validatePatterns($this->parameters['skip_patterns'], array('/^_cache/', '/^_content/', '/^_counter/', '/^theme_info\\.yml/', '/(\\.DS_Store)|(Thumbs.db)|(\\.git)|(\\.hg)|(\\.svn)/'));
// Validate force-bake patterns.
$this->parameters['force_patterns'] = self::validatePatterns($this->parameters['force_patterns']);
// Compute the number of characters we need to remove from file paths
// to get their relative paths.
$rootDir = $this->pieCrust->getRootDir();
$this->rootDirLength = strlen(rtrim($rootDir, '/\\')) + 1;
$this->mountDirLengths = array();
foreach ($this->parameters['mounts'] as $name => $dir) {
$this->mountDirLengths[$name] = strlen(rtrim($dir, '/\\')) + 1;
}
$this->bakedFiles = array();
if (!is_dir($this->bakeDir) or !is_writable($this->bakeDir)) {
throw new PieCrustException('The bake directory is not writable, or does not exist: ' . $this->bakeDir);
}
}
示例2: recherche
/**
* @name recherche( $pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri )
* @param string nom de la table
* @param string Le type de critère de recherche
* @param array(string) champs à récupérer dans la table
* @param array(array(string, object)) Dictionnaire(champ, valeur)) contenant les champs à filtrer ainsi que la valeur du filtre
* @param array(array(string, string)) Dictionnaire(champ, sens) contenant les tris à appliquer
* @return array(GestionListeCommandeEnCoursViewVO)
* @desc Récupères les lignes de la table selon le critère de recherche puis trie et renvoie la liste de résultat sous forme d'une collection de GestionListeCommandeEnCoursViewVO
*/
public static function recherche($pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri)
{
// Initialisation du Logger
$lLogger =& Log::singleton('file', CHEMIN_FICHIER_LOGS);
$lLogger->setMask(Log::MAX(LOG_LEVEL));
// Préparation de la requète
$lChamps = array(CommandeManager::CHAMP_COMMANDE_ID . "," . CommandeManager::CHAMP_COMMANDE_NOM . "," . CommandeManager::CHAMP_COMMANDE_NUMERO . "," . CommandeManager::CHAMP_COMMANDE_DATE_FIN_RESERVATION . "," . CommandeManager::CHAMP_COMMANDE_DATE_MARCHE_DEBUT . "," . CommandeManager::CHAMP_COMMANDE_DATE_MARCHE_FIN);
// Préparation de la requète de recherche
$lRequete = DbUtils::prepareRequeteRecherche(GestionListeCommandeEnCoursViewManager::VUE_LISTECOMMANDEENCOURS, $lChamps, $pTypeRecherche, $pTypeCritere, $pCritereRecherche, $pTypeTri, $pCritereTri);
$lListeGestionListeCommandeEnCours = array();
if ($lRequete !== false) {
$lLogger->log("Execution de la requete : " . $lRequete, PEAR_LOG_DEBUG);
// Maj des logs
$lSql = Dbutils::executerRequete($lRequete);
if (mysql_num_rows($lSql) > 0) {
while ($lLigne = mysql_fetch_assoc($lSql)) {
array_push($lListeGestionListeCommandeEnCours, GestionListeCommandeEnCoursViewManager::remplir($lLigne[CommandeManager::CHAMP_COMMANDE_ID], $lLigne[CommandeManager::CHAMP_COMMANDE_NOM], $lLigne[CommandeManager::CHAMP_COMMANDE_NUMERO], $lLigne[CommandeManager::CHAMP_COMMANDE_DATE_FIN_RESERVATION], $lLigne[CommandeManager::CHAMP_COMMANDE_DATE_MARCHE_DEBUT], $lLigne[CommandeManager::CHAMP_COMMANDE_DATE_MARCHE_FIN]));
}
} else {
$lListeGestionListeCommandeEnCours[0] = new GestionListeCommandeEnCoursViewVO();
}
return $lListeGestionListeCommandeEnCours;
}
$lListeGestionListeCommandeEnCours[0] = new GestionListeCommandeEnCoursViewVO();
return $lListeGestionListeCommandeEnCours;
}
示例3: ob_show_and_log
function ob_show_and_log($type)
{
$log =& Log::singleton('file', USERBASE . 'log.txt', $type, array('locking' => true, 'timeFormat' => '%Y-%m-%d %H:%M:%S'));
$length = $GLOBALS['filesize'];
$num_queries = isset($GLOBALS['db']) ? $GLOBALS['db']->num_queries : 0;
switch ($type) {
case 'file':
// {
$location = $_SERVER['REQUEST_URI'];
break;
// }
// }
case 'menu':
// {
$location = 'menu';
break;
// }
// }
case 'page':
// {
$location = $GLOBALS['PAGEDATA']->id . '|' . $GLOBALS['PAGEDATA']->getRelativeUrl();
break;
// }
// }
default:
// {
$location = 'unknown_type_' . $type;
//}
}
$log->log($_SERVER['REMOTE_ADDR'] . ' ' . $location . ' ' . $_SERVER['HTTP_USER_AGENT'] . ' ' . $_SERVER['HTTP_REFERER'] . ' ' . memory_get_peak_usage() . ' ' . $length . ' ' . (microtime(true) - START_TIME) . ' ' . $num_queries);
ob_flush();
}
示例4: __construct
/**
* Creates a new instance of PieCrustImporter.
*/
public function __construct(IPieCrust $pieCrust, $logger = null)
{
$this->pieCrust = $pieCrust;
if ($logger == null) {
$logger = \Log::singleton('null', '', '');
}
$this->logger = $logger;
}
示例5:
function &get_logger()
{
global $klogger;
if ($klogger == null) {
$klogger =& Log::singleton('error_log', PEAR_LOG_TYPE_SYSTEM, 'kauth');
}
return $klogger;
}
示例6: initialize
public function initialize(IPieCrust $pieCrust, $logger = null)
{
$this->pieCrust = $pieCrust;
if ($logger == null) {
$logger = \Log::singleton('null', '', '');
}
$this->logger = $logger;
}
示例7: WordPressOpenID
function WordPressOpenID()
{
$this->log =& Log::singleton('error_log', PEAR_LOG_TYPE_SYSTEM, 'OpenID');
//$this->log = &Log::singleton('file', ABSPATH . get_option('upload_path') . '/php.log', 'WPOpenID');
// Set the log level
$wpopenid_log_level = constant('PEAR_LOG_' . strtoupper(WPOPENID_LOG_LEVEL));
$this->log->setMask(Log::UPTO($wpopenid_log_level));
}
示例8:
function &singleton()
{
static $log = null;
if (is_null($log)) {
$log =& Log::singleton('file', JX_BASE_LOG, 'JAX');
}
return $log;
}
示例9: getInst
private static function getInst()
{
if (BBLog::$inst == null) {
$conf = array('error_prepend' => '<font color="#ff0000"><tt>', 'error_append' => '</tt></font>', 'buffering' => true);
BBLog::$inst = Log::singleton("display", '', 'BBLog', $conf, PEAR_LOG_ERR);
}
return BBLog::$inst;
}
示例10: __construct
public function __construct(array $processors, $logger = null)
{
$this->processors = $processors;
if ($logger == null) {
$logger = \Log::singleton('null', '', '');
}
$this->logger = $logger;
}
示例11: __construct
/**
* Creates a new instance of PageBaker.
*/
public function __construct($bakeDir, array $parameters = array(), $logger = null)
{
$this->bakeDir = rtrim(str_replace('\\', '/', $bakeDir), '/') . '/';
$this->parameters = array_merge(array('copy_assets' => false, 'bake_record' => null), $parameters);
if ($logger == null) {
$logger = \Log::singleton('null', '', '');
}
$this->logger = $logger;
}
示例12: logger
function logger($key, $log_file)
{
$mask = Log::MAX(PEAR_LOG_DEBUG);
$conf = array('mode' => 0600, 'dirmode' => 777, 'lineFormat' => '%{timestamp} [%{priority}]: %{message}', 'timeFormat' => '%d/%m/%Y %H:%M:%S');
$this->_key = $key;
$this->_log_file = $log_file;
$this->_logger =& Log::singleton('file', $this->_log_file, $this->_key, $conf);
$this->_logger->setMask($mask);
}
示例13: _singleton
/**
*
*/
private static function _singleton()
{
static $instance;
if (!isset($instance) || !$instance instanceof Log) {
$options = array('append' => true, 'locking' => false, 'mode' => 0640, 'timeFormat' => '[%Y-%m-%d %H:%M:%S]', 'lineFormat' => '%1$s [%3$s] [' . uniqid() . '] %4$s');
$instance = parent::singleton('file', CINTIENT_LOG_FILE, 'cintient', $options, PEAR_LOG_DEBUG);
}
return $instance;
}
示例14: test__main
/**
* Run a full system test based on phpcs output.
*
* @return void
*/
public function test__main()
{
$controller = new CbCLIController(null, array(PHPCB_SOURCE), PHPCB_TEST_OUTPUT, array(), array(), array(), new CbIOHelper(), Log::singleton('null'), array('php'));
$controller->addErrorPlugins(array('CbErrorCheckstyle', 'CbErrorPMD', 'CbErrorCPD', 'CbErrorPadawan', 'CbErrorCoverage', 'CbErrorCRAP'));
$controller->run();
$this->assertFileExists(PHPCB_TEST_OUTPUT . '/index.html');
$this->assertFileExists(PHPCB_TEST_OUTPUT . '/CLIController.php.html');
$this->assertFileExists(PHPCB_TEST_OUTPUT . '/css');
}
示例15: __construct
function __construct()
{
// create Log object
$this->pearLogger =& Log::singleton("sql", "log_table", __FILE__, array('dsn' => "mysql://" . dbuser . ":" . dbpassword . "@" . mysqlServerIP . "/" . dbname, 'identLimit' => 300));
$mask = Log::MIN(PEAR_LOG_ERR);
$this->pearLogger->setMask($mask);
set_error_handler(array($this, 'errorHandler'));
set_exception_handler(array($this, 'exceptionHandler'));
}