本文整理汇总了PHP中logger::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP logger::getInstance方法的具体用法?PHP logger::getInstance怎么用?PHP logger::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger
的用法示例。
在下文中一共展示了logger::getInstance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cronInit
private function cronInit()
{
foreach (extension::getInstance()->getAllParams() as $ext_type => $ext_data) {
foreach ($ext_data as $ext_item) {
if ($ext_item['enabled'] == 1) {
$ext_file = root . '/extensions/' . $ext_type . '/' . $ext_item['dir'] . '/cron.php';
if (file_exists($ext_file)) {
@(require_once $ext_file);
$cname = 'cron_' . $ext_item['dir'];
if (class_exists($cname)) {
$link = new $cname();
if (method_exists($link, 'getInstance') && method_exists($link, 'make')) {
$link::getInstance()->make();
} else {
logger::getInstance()->log(logger::LEVEL_WARN, 'Method getInstance() or make() not founded in cron ' . $ext_file);
}
} else {
logger::getInstance()->log(logger::LEVEL_WARN, 'Class ' . $cname . ' not founded in cron ' . $ext_file);
}
}
}
}
}
return null;
}
示例2: _initLogger
protected function _initLogger()
{
require_once APPLICATION_PATH . '/helper/logger/logger.php';
require_once APPLICATION_PATH . '/helper/logger/abstractStrategy.php';
require_once APPLICATION_PATH . '/helper/logger/fileStrategy.php';
$fileStrategy = new fileStrategy();
$fileStrategy->setFilename(dirname(__FILE__) . '/../app_log/log_' . date('Y-m-d') . '.txt');
logger::getInstance()->addLogStrategy($fileStrategy);
logger::getInstance()->setLogLevel(logger::LEVEL_OK);
}
示例3: checkDirectoryAvailable
protected static function checkDirectoryAvailable()
{
if (!file_exists(root . self::CACHE_DIR)) {
try {
system::getInstance()->createPrivateDirectory(root . self::CACHE_DIR);
} catch (\Exception $e) {
logger::getInstance()->log(logger::LEVEL_ERR, 'File cache directory can`t be created: ' . $e->getMessage());
}
}
}
示例4: seitenaufrufeAction
public function seitenaufrufeAction()
{
logger::getInstance()->log('Starte Export Seitenaufrufe ', logger::LEVEL_OK);
$_Model = new Application_Model_Seitenaufruf();
/* Prüfen ob von bis, sonst die letzte Stunde */
$from = $this->getRequest()->getParam('from', false);
$to = $this->getRequest()->getParam('to', false);
logger::getInstance()->log('from= ' . $from . ' to=' . $to, logger::LEVEL_OK);
if ($from && $to) {
logger::getInstance()->log('Hole Daten per $_Model->getAllFromTo( $from, $to )', logger::LEVEL_INFO);
$this->genericExport($_Model->getAllFromTo($from, $to));
} else {
$this->genericExport($_Model->getAllLastHours(1));
}
logger::getInstance()->log('Beende Export Seitenaufrufe ', logger::LEVEL_OK);
}
示例5: init
public function init()
{
if (is_null($this->link)) {
if (file_exists(root . '/config.php')) {
try {
$this->link = @new \PDO("mysql:host=" . property::getInstance()->get('db_host') . ";dbname=" . property::getInstance()->get('db_name') . "", property::getInstance()->get('db_user'), property::getInstance()->get('db_pass'), array(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, \PDO::ATTR_EMULATE_PREPARES => false, \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8", \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_PERSISTENT => false));
} catch (\PDOException $e) {
if (loader != 'install') {
logger::getInstance()->log(logger::LEVEL_ERR, "Database is down! Check configuration and database server uplink! Log: " . $e->getMessage());
exit(language::getInstance()->get('database_down_desc') . " " . property::getInstance()->get('mail_from'));
}
}
} else {
logger::getInstance()->log(logger::LEVEL_ERR, "Configuration file /config.php is not available - database connect FAIL!");
}
}
}
示例6: call
/**
* Call to extension class functions from remote class. Ex: extension::getInstance()->call(extension::TYPE_COMPONENT, 'static')->display();
* @param string $type
* @param string $object
* @param boolean $is_back
* @return mixed
*/
public function call($type, $object, $is_back = false)
{
if (!is_object($this->callobjects[$type][$object])) {
if (array_key_exists($type, $this->extconfigs) && array_key_exists($object, $this->extconfigs[$type])) {
$file = root . '/extensions/' . $type . '/' . $object;
if ($is_back) {
$file .= '/back.php';
} else {
$file .= '/front.php';
}
if (file_exists($file)) {
@(require_once $file);
$cname = $type . '_' . $object;
if ($is_back) {
$cname .= '_back';
} else {
$cname .= '_front';
}
if (class_exists($cname)) {
$init = @new $cname();
if (method_exists($cname, 'getInstance')) {
$instance = @$init::getInstance();
if (is_object($instance)) {
$this->callobjects[$type][$object][$is_back ? 'back' : 'front'] = $instance;
} else {
logger::getInstance()->log(logger::LEVEL_WARN, 'Method getInstance() dosnt return object link for self(return $this) in file ' . $file);
}
} else {
logger::getInstance()->log(logger::LEVEL_WARN, 'Method getInstance() not founded in file ' . $file);
}
} else {
logger::getInstance()->log(logger::LEVEL_WARN, "Class " . $cname . " not found in file " . $file);
}
} else {
logger::getInstance()->log(logger::LEVEL_ERR, "File of extensions dosnt exists: " . $file);
}
}
}
return $this->callobjects[$type][$object][$is_back ? 'back' : 'front'];
}
示例7: twigLoader
protected function twigLoader()
{
$twig_cache = root . '/cache/';
$tpl_name = $this->getIfaceTemplate();
switch (loader) {
case 'front':
case 'api':
$twig_cache .= user::getInstance()->get('id') < 1 ? 'guest' : 'uid' . user::getInstance()->get('id');
break;
case 'back':
$twig_cache .= 'admintmp';
break;
case 'install':
$twig_cache .= 'installtmp';
break;
}
$template_path_root = root . '/' . property::getInstance()->get('tpl_dir') . '/' . $tpl_name;
if (!file_exists($template_path_root)) {
// mb default template is available ?
if (file_exists(root . '/' . property::getInstance()->get('tpl_dir') . '/default') && in_array(loader, array('front', 'api'))) {
property::getInstance()->set('tpl_name', 'default');
$template_path_root = root . '/' . property::getInstance()->get('tpl_dir') . '/default';
} else {
exit("Template " . $tpl_name . " is not founded! Exit");
}
logger::getInstance()->log(logger::LEVEL_ERR, 'Template ' . $tpl_name . ' is not founded. Use default template.');
}
require_once root . "/resource/Twig/Autoloader.php";
\Twig_Autoloader::register();
$this->twig_file = new \Twig_Environment(new \Twig_Loader_Filesystem($template_path_root), array('cache' => $twig_cache, 'charset' => 'utf-8', 'autoescape' => false, 'strict_variables' => false));
if (loader == 'install' || permission::getInstance()->have('global/owner')) {
// auto rebuild cache for owner
$this->twig_file->enableAutoReload();
}
$this->twig_string = new \Twig_Environment(new \Twig_Loader_String());
}
示例8: getInstance
*
* Return logger instance or create new instance
*
* @return object (PDO)
*
* @access public
*
*/
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new Logger();
}
return self::$instance;
}
/**
* Clone is set to private to stop cloning
*
*/
private function __clone()
{
}
}
function debug_message($message)
{
if (DEBUG_MODE == 'On') {
print $message . "<br/>";
}
}
$ob_log = logger::getInstance();
示例9: logIn
private static function logIn($userName)
{
$user = currentUser::getUserSession();
$database = database::getInstance();
$database->connect();
$userData = $database->getData('u.firstName, u.lastName, u.userID, u.roleID', 'users u, activeDirectory ad', 'WHERE u.userID = ad.userID AND ad.adUsername = \'' . $userName . '\'');
if ($userData === null) {
return;
}
if (count($userData) > 1) {
return;
}
$user->setLoggedIn(true);
$user->setFirstName($userData[0]['firstName']);
$user->setLastName($userData[0]['lastName']);
$user->setUserID($userData[0]['userID']);
$user->setRoleID($userData[0]['roleID']);
currentUser::setUserSession($user);
$database->updateTable('users', 'lastAccess = CURRENT_TIMESTAMP', 'userID = ' . $user->getUserID());
$log = new logEntry(1, logEntryType::neutral, $user->getUserID(), $user->getFullName() . ' logged in using Active Directory from an IP of ' . $_SERVER['REMOTE_ADDR'] . '.', $user->getUserID);
logger::getInstance()->logIt($log);
}
示例10: query
/**
* dbConnection::query()
* Execute the passed query on the database and determine if insert_id or affected_rows or numrows has to be called.
* @param String $query Query to be executed.
* @returns mixed ID if inserted row, false on error
*/
function query($query)
{
if ($this->adapter->connection == false) {
logger::getInstance()->LogEmail('Not connected');
return false;
}
if ($this->debug) {
Logger::getInstance()->log[] = "executing: {$query}";
}
$result = $this->adapter->query($query);
if (!$result) {
$error = $this->adapter->getError();
if ($error != '' && $this->adapter->connection != false) {
Logger::Warn("Error '{$error}' during execution of query {$query}");
}
return false;
}
$query = trim(strtolower($query));
$firstpart = substr($query, 0, 6);
$this->insertID = false;
$this->affected = false;
$this->numrows = false;
switch ($firstpart) {
case 'insert':
$this->insertID = $this->adapter->getInsertID();
break;
case 'delete':
case 'replac':
case 'update':
$this->affected = $this->adapter->numAffected();
break;
case 'select':
$this->numrows = $this->adapter->numRows();
break;
}
if ($this->insertID != false) {
return $this->insertID;
}
return true;
}
示例11: printStrategy
<?php
require_once 'logger.php';
require_once 'abstractStrategy.php';
require_once 'printStrategy.php';
require_once 'fileStrategy.php';
require_once 'firePhpStrategy.php';
logger::getInstance()->addLogStrategy(new printStrategy());
logger::getInstance()->addLogStrategy(new firePhpStrategy());
$fileStrategy = new fileStrategy();
$fileStrategy->setFilename('log.txt');
logger::getInstance()->addLogStrategy($fileStrategy);
logger::getInstance()->log('Logeintrag xyz', logger::LEVEL_ERROR, "import");
logger::getInstance()->clearLogStrategy();
示例12: genericImporter
protected function genericImporter($_model, $url)
{
logger::getInstance()->log('Starte Import von ' . $url, logger::LEVEL_OK);
#logger::getInstance()->setLogLevel(logger::LEVEL_INFO);
$document = new DOMDocument();
$document->load($url);
$element = $document->documentElement;
/* Hole alle ID's der Datenbank. ID's sollten immer mit denen der Verwaltung übereinstimmen */
$allDBData = $_model->getAll();
$allDBIDs = array();
if (count($allDBData)) {
foreach ($allDBData as $dataObj) {
$allDBIDs[$dataObj->id] = $dataObj->id;
}
}
logger::getInstance()->log('allDBIDs Dump: ' . var_export($allDBIDs, true), logger::LEVEL_VERBOSE);
foreach ($element->childNodes as $node) {
/* @var $node DOMNode */
if ($node->hasChildNodes()) {
$tmpDataset = array();
foreach ($node->childNodes as $subnode) {
/* @var $subnode DOMNode */
if ($subnode->hasChildNodes()) {
$tmpDataset[$subnode->nodeName] = $subnode->nodeValue;
} else {
if ($subnode->nodeName != '#text') {
$tmpDataset[$subnode->nodeName] = $subnode->nodeValue;
}
}
}
$id = $tmpDataset['id'];
if ($_model->isExisting($id)) {
logger::getInstance()->log('Datensatz mit ID ' . $tmpDataset['id'] . ' vorhanden -> UPDATE', logger::LEVEL_INFO);
unset($tmpDataset['id']);
unset($allDBIDs[$id]);
$tmpDataset = $this->cleanValues($tmpDataset);
logger::getInstance()->log('Update Datensatz : ' . var_export($tmpDataset, true), logger::LEVEL_VERBOSE);
$_model->update($tmpDataset, array('id = ?' => $id));
} else {
logger::getInstance()->log('Datensatz mit ID ' . $id . ' nicht vorhanden -> INSERT', logger::LEVEL_INFO);
logger::getInstance()->log('Insert Datensatz : ' . var_export($tmpDataset, true), logger::LEVEL_VERBOSE);
$tmpDataset = $this->cleanValues($tmpDataset);
$_model->insert($tmpDataset);
}
}
}
/* Lösche alle Datensätze, die nicht per Import von Verwaltung gekommen sind */
logger::getInstance()->log('allDBIDs vor Löschen Dump: ' . var_export($allDBIDs, true), logger::LEVEL_VERBOSE);
if (count($allDBIDs)) {
logger::getInstance()->log('Entferne ' . count($allDBIDs) . ' Datensätze', logger::LEVEL_INFO);
foreach ($allDBIDs as $id) {
$params = array('id = ?' => $id);
logger::getInstance()->log('Entferne mit delete Parametern :' . var_export($params, true), logger::LEVEL_INFO);
$_model->delete($params);
}
}
logger::getInstance()->log('Benden Import Import von ' . $url, logger::LEVEL_OK);
}
示例13: loadVersionMd5List
private function loadVersionMd5List()
{
$ff_repo_url = self::REMOTE_CHECKSUM . '?version=' . version;
$save_cache_name = 'antivirus_checksum_' . version;
if (cache::getInstance()->get($save_cache_name, self::REMOTE_CACHETIME)) {
$this->version_md5 = @unserialize(cache::getInstance()->get($save_cache_name, self::REMOTE_CACHETIME));
return null;
}
$response = system::getInstance()->url_get_contents($ff_repo_url);
if (!is_null($response) && $response != 'error') {
$this->version_md5 = @unserialize($response);
} else {
$md5file = root . "/resource/antivirus/.md5sum";
if (file_exists($md5file)) {
$this->version_md5 = unserialize(@file_get_contents($md5file));
logger::getInstance()->log(logger::LEVEL_NOTIFY, 'Using local antivirus signature. Remote repository with hashsum antivirus is not available: ' . $ff_repo_url);
} else {
logger::getInstance()->log(logger::LEVEL_WARN, 'Local antivirus hashsum signature not founded:' . $md5file);
}
}
cache::getInstance()->save($save_cache_name, serialize($this->version_md5));
}