本文整理汇总了PHP中logger::log方法的典型用法代码示例。如果您正苦于以下问题:PHP logger::log方法的具体用法?PHP logger::log怎么用?PHP logger::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger
的用法示例。
在下文中一共展示了logger::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: debug
public static function debug($message)
{
logger::log($message, LOG_SYS_DEBUG);
}
示例2: save
/**
+----------------------------------------------------------
* 日志保存
+----------------------------------------------------------
* @static
* @access public
+----------------------------------------------------------
* @param integer $type 日志记录方式
* @param string $destination 写入目标
* @param string $extra 额外参数
+----------------------------------------------------------
* @return void
+----------------------------------------------------------
*/
static function save($type = self::FILE, $destination = '', $extra = '')
{
if (empty($destination)) {
if (!is_dir(APP_ROOT_PATH . "public/logger/")) {
if (!mkdir(APP_ROOT_PATH . "public/logger/")) {
return false;
}
}
$destination = APP_ROOT_PATH . "public/logger/" . date('y_m_d') . ".logger";
}
if (self::FILE == $type) {
// 文件方式记录日志信息
//检测日志文件大小,超过配置大小则备份日志文件重新生成,日志大小2MB
if (is_file($destination) && floor(2000000) <= filesize($destination)) {
rename($destination, dirname($destination) . '/' . time() . '-' . basename($destination));
}
}
error_log(implode("", self::$log), $type, $destination, $extra);
// 保存后清空日志缓存
self::$log = array();
//clearstatcache();
}
示例3: executeInstaller
/**
* @author Ignacio Vazquez - elpepe.uy@gmail.com
* @param array of string $pluginNames
* TODO avoid using mysql functions - (copied from installer)
*/
static function executeInstaller($name)
{
$table_prefix = TABLE_PREFIX;
tpl_assign('table_prefix', $table_prefix);
$default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
tpl_assign('default_charset', $default_charset);
$default_collation = 'collate utf8_unicode_ci';
tpl_assign('default_collation', $default_collation);
$engine = DB_ENGINE;
tpl_assign('engine', $engine);
$path = ROOT . "/plugins/{$name}/info.php";
if (file_exists($path)) {
DB::beginWork();
$pluginInfo = (include_once $path);
//0. Check if exists in plg table
$sql = "SELECT id FROM " . TABLE_PREFIX . "plugins WHERE name = '{$name}' ";
$res = @mysql_query($sql);
if (!$res) {
DB::rollback();
return false;
}
$plg_obj = mysql_fetch_object($res);
if (!$plg_obj) {
//1. Insert into PLUGIN TABLE
$cols = "name, is_installed, is_activated, version";
$values = "'{$name}', 1, 1 ,'" . array_var($pluginInfo, 'version') . "'";
if (is_numeric(array_var($pluginInfo, 'id'))) {
$cols = "id, " . $cols;
$values = array_var($pluginInfo, 'id') . ", " . $values;
}
$sql = "INSERT INTO " . TABLE_PREFIX . "plugins ({$cols}) VALUES ({$values}) ";
if (@mysql_query($sql)) {
$id = @mysql_insert_id();
$pluginInfo['id'] = $id;
} else {
echo "ERROR: " . mysql_error();
@mysql_query('ROLLBACK');
return false;
}
} else {
$id = $plg_obj->id;
$pluginInfo['id'] = $id;
}
//2. IF Plugin defines types, INSERT INTO ITS TABLE
if (count(array_var($pluginInfo, 'types'))) {
foreach ($pluginInfo['types'] as $k => $type) {
if (isset($type['name'])) {
$sql = "\n\t\t\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "object_types (name, handler_class, table_name, type, icon, plugin_id)\n\t\t\t\t\t\t\t \tVALUES (\n\t\t\t\t\t\t\t \t'" . array_var($type, "name") . "', \n\t\t\t\t\t\t\t \t'" . array_var($type, "handler_class") . "', \n\t\t\t\t\t\t\t \t'" . array_var($type, "table_name") . "', \n\t\t\t\t\t\t\t \t'" . array_var($type, "type") . "', \n\t\t\t\t\t\t\t \t'" . array_var($type, "icon") . "', \n\t\t\t\t\t\t\t\t{$id}\n\t\t\t\t\t\t\t)";
if (@mysql_query($sql)) {
$pluginInfo['types'][$k]['id'] = @mysql_insert_id();
$type['id'] = @mysql_insert_id();
} else {
echo $sql . "<br/>";
echo mysql_error() . "<br/>";
DB::rollback();
return false;
}
}
}
}
//2. IF Plugin defines tabs, INSERT INTO ITS TABLE
if (count(array_var($pluginInfo, 'tabs'))) {
foreach ($pluginInfo['tabs'] as $k => $tab) {
if (isset($tab['title'])) {
$type_id = array_var($type, "id");
$sql = "\n\t\t\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "tab_panels (\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\ttitle, \n\t\t\t\t\t\t\t\ticon_cls, \n\t\t\t\t\t\t\t\trefresh_on_context_change, \n\t\t\t\t\t\t\t\tdefault_controller, \n\t\t\t\t\t\t\t\tdefault_action, \n\t\t\t\t\t\t\t\tinitial_controller, \n\t\t\t\t\t\t\t\tinitial_action, \n\t\t\t\t\t\t\t\tenabled, \n\t\t\t\t\t\t\t\ttype, \n\t\t\t\t\t\t\t\tplugin_id, \n\t\t\t\t\t\t\t\tobject_type_id )\n\t\t\t\t\t\t \tVALUES (\n\t\t\t\t\t\t \t\t'" . array_var($tab, 'id') . "', \n\t\t\t\t\t\t \t\t'" . array_var($tab, 'title') . "', \n\t\t\t\t\t\t \t\t'" . array_var($tab, 'icon_cls') . "',\n\t\t\t\t\t\t \t\t'" . array_var($tab, 'refresh_on_context_change') . "',\n\t\t\t\t\t\t \t\t'" . array_var($tab, 'default_controller') . "',\n\t\t\t\t\t\t \t\t'" . array_var($tab, 'default_action') . "',\n\t\t\t\t\t\t\t\t'" . array_var($tab, 'initial_controller') . "',\n\t\t\t\t\t\t\t\t'" . array_var($tab, 'initial_action') . "',\n\t\t\t\t\t\t\t\t'" . array_var($tab, 'enabled', 1) . "',\n\t\t\t\t\t\t\t\t'" . array_var($tab, 'type') . "',\n\t\t\t\t\t\t\t\t{$id},\n\t\t\t\t\t\t\t\t" . array_var($tab, 'object_type_id') . "\n\t\t\t\t\t\t\t)";
if (!@mysql_query($sql)) {
echo $sql;
echo mysql_error();
DB::rollback();
return false;
}
// INSERT INTO TAB PANEL PERMISSSION
$sql = "\n\t\t\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "tab_panel_permissions (\n\t\t\t\t\t\t\t\tpermission_group_id,\n\t\t\t\t\t\t\t\ttab_panel_id \n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t \tVALUES ( 1,'" . array_var($tab, 'id') . "' ), ( 2,'" . array_var($tab, 'id') . "' ) ON DUPLICATE KEY UPDATE permission_group_id = permission_group_id ";
if (!@mysql_query($sql)) {
echo $sql;
echo mysql_error();
@mysql_query('ROLLBACK');
DB::rollback();
return false;
}
}
}
}
// Create schema sql query
$schema_creation = ROOT . "/plugins/{$name}/install/sql/mysql_schema.php";
if (file_exists($schema_creation)) {
$total_queries = 0;
$executed_queries = 0;
if (executeMultipleQueries(tpl_fetch($schema_creation), $total_queries, $executed_queries)) {
logger::log("Schema created for plugin {$name} ");
} else {
//echo tpl_fetch ( $schema_creation );
echo mysql_error();
echo "llega <br>";
//.........这里部分代码省略.........
示例4: mkdir
//directory for additional languages
$langDir = PIMCORE_WEBSITE_PATH . "/var/config/texts";
if (!is_dir($langDir)) {
mkdir($langDir, 0755, true);
}
$success = is_dir($langDir);
if ($success) {
$language = "de";
$src = "http://www.pimcore.org/?controller=translation&action=download&language=" . $language;
$data = @file_get_contents($src);
if (!empty($language) and !empty($data)) {
try {
$languageFile = $langDir . "/" . $language . ".csv";
$fh = fopen($languageFile, 'w');
fwrite($fh, $data);
fclose($fh);
} catch (Exception $e) {
logger::log("could not download language file", Zend_Log::WARN);
logger::log($e);
$success = false;
}
}
}
?>
<b>Release Notes (545):</b>
<br/>
- Added system languages download<br/>
- Removed german from core languages, moved additional system languages to website/var/config/texts
示例5: checkAndPrepareIndex
protected function checkAndPrepareIndex()
{
if (!$this->index) {
$indexDir = SearchPhp_Plugin::getFrontendSearchIndex();
//switch to tmpIndex
$indexDir = str_replace("/index", "/tmpindex", $indexDir);
try {
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
$this->index = Zend_Search_Lucene::open($indexDir);
} catch (Exception $e) {
logger::log(get_class($this) . ": could not open frontend index, creating new one.", Zend_Log::WARN);
Zend_Search_Lucene::create($indexDir);
$this->index = Zend_Search_Lucene::open($indexDir);
}
}
}
示例6: init
/**
* 初始化
* @param unknown $config
*/
public static function init($config)
{
$logger_class = isset($config["logger_class"]) ? $config["logger_class"] : "log_file_logger";
self::$log = new $logger_class();
self::$log->init($config);
}
示例7: exec
logger::log("SearchPhp_Plugin: Starting crawl", Zend_Log::DEBUG);
//TODO nix specific
exec("rm -Rf " . str_replace("/index", "/tmpindex", $indexDir) . " " . $indexDir);
$confArray = SearchPhp_Plugin::getSearchConfigArray();
$urls = explode(",", $confArray['search']['frontend']['urls']);
$validLinkRegexes = explode(",", $confArray['search']['frontend']['validLinkRegexes']);
$invalidLinkRegexes = explode(",", $confArray['search']['frontend']['invalidLinkRegexes']);
$rawConfig = new Zend_Config_Xml(PIMCORE_PLUGINS_PATH . SearchPhp_Plugin::$configFile);
$rawConfigArray = $rawConfig->toArray();
$rawConfigArray['search']['frontend']['crawler']['running'] = 1;
$rawConfigArray['search']['frontend']['crawler']['started'] = time();
$config = new Zend_Config($rawConfigArray, true);
$writer = new Zend_Config_Writer_Xml(array("config" => $config, "filename" => PIMCORE_PLUGINS_PATH . SearchPhp_Plugin::$configFile));
$writer->write();
$crawler = new SearchPhp_Frontend_Crawler($validLinkRegexes, $invalidLinkRegexes, 10, 30, $confArray['search']['frontend']['crawler']['contentStartIndicator'], $confArray['search']['frontend']['crawler']['contentEndIndicator']);
$crawler->findLinks($urls);
$rawConfig = new Zend_Config_Xml(PIMCORE_PLUGINS_PATH . SearchPhp_Plugin::$configFile);
$rawConfigArray = $rawConfig->toArray();
$rawConfigArray['search']['frontend']['crawler']['running'] = 0;
$rawConfigArray['search']['frontend']['crawler']['finished'] = time();
$config = new Zend_Config($rawConfigArray, true);
$writer = new Zend_Config_Writer_Xml(array("config" => $config, "filename" => PIMCORE_PLUGINS_PATH . SearchPhp_Plugin::$configFile));
$writer->write();
logger::log("SearchPhp_Plugin: replacing old index ...", Zend_Log::DEBUG);
$indexDir = SearchPhp_Plugin::getFrontendSearchIndex();
//TODO nix specific
exec("rm -Rf " . $indexDir);
exec("mv " . str_replace("/index", "/tmpindex", $indexDir) . " " . $indexDir);
logger::log("Search_PluginPhp: replaced old index", Zend_Log::DEBUG);
logger::log("Search_PluginPhp: Finished crawl", Zend_Log::DEBUG);
示例8: logger
<?php
require_once 'logger.inc';
require_once 'path.inc';
require_once 'get_host_info.inc';
require_once 'rabbitMQLib.inc';
$logger = new logger("logger.inc");
if (isset($argv[1])) {
$msg = $argv[1];
} else {
$msg = "test message";
}
$logger->log("This should fail!");
示例9: array
$vars = array('title', 'keywords', 'description', 'padding_top', 'body');
$cache = new cache();
if ($cached = $cache->get()) {
foreach ($vars as $var) {
${$var} = $cached[$var];
}
} else {
// initialization
$db = new db();
$db->connect($dsn);
$db->msg = $msg;
// authentication & and logging
$auth = new Auth('MDB2', array('dsn' => $db->dsn, 'table' => "sys_user", 'usernamecol' => "user_id", 'passwordcol' => "pass_key"), 'login');
$auth->start();
$logger = new logger($db, $auth);
$logger->log();
// define mod
$mods = array('user', 'dictionary', 'glossary', 'home', 'doc', 'proverb', 'abbr', 'dict2');
$_GET['mod'] = strtolower($_GET['mod']);
if ($_GET['mod'] == 'dict') {
$_GET['mod'] = 'dictionary';
}
// backward
if ($_GET['mod'] == 'glo') {
$_GET['mod'] = 'glossary';
}
// backward
if (!in_array($_GET['mod'], $mods)) {
$_GET['mod'] = 'home';
}
$mod = $_GET['mod'];
示例10: logger
#!/usr/bin/php
<?php
require_once 'path.inc';
require_once 'get_host_info.inc';
require_once 'rabbitMQLib.inc';
require_once 'logger.inc';
$logger = new logger("logger.inc");
try {
$client = new rabbitMQClient("testRabbitMQ.ini", "testServer");
if (isset($argv[1])) {
$msg = $argv[1];
} else {
$msg = "test message";
}
$request = array();
$request[0] = "login";
$request[1] = array("agoldman", "bodypillow");
$response = $client->send_request($request);
$logger->log("received", $response);
echo "client received response: " . PHP_EOL;
print_r($response);
echo "\n\n";
echo $argv[0] . " END" . PHP_EOL;
} catch (Exception $e) {
$logger->log("error", $e->geMessage());
}
示例11: logger
<?php
require_once 'logger.inc';
$test = new logger('logger.inc');
$test->log("sent", "words");
示例12: deleteAllForTarget
/**
* Deletes all comments for the current target
*
* @return void
*/
public function deleteAllForTarget()
{
if ($this->model != null) {
$targetId = $this->model->getTargetId();
if (!empty($targetId)) {
try {
$this->db->delete("plugin_ratingscomments_ratings", "targetId='" . $targetId . "'");
} catch (Exception $e) {
logger::log(get_class($this) . ": Could not delete ratings for target id [" . $targetId . "]");
throw $e;
}
}
}
}
示例13: header
<?php
if (!defined('PROPER_START')) {
header("HTTP/1.0 403 Forbidden");
exit;
}
if (preg_match("/^[0-9]{2,30}\$/", $_POST['id']) != 1) {
raise(new SecurityException(iSeverity::CRITICAL, $lang['ABNORMAL_PARAMETER_VALUE']));
}
$form = new form('edit_domain');
$form->checkReferer();
$form->reset();
$form->importValues($_POST);
$form->setCheck('dir', $lang['check_dir'], formCheck::ALLTEXT, 2, 30, true);
if (preg_match("/(^\\/?\\.\\.|\\/\\.\\.\\/?\$|\\/\\.\\.\\/|\\\\|\\s)/", $_POST['dir']) > 0) {
$form->setError('dir', $lang['check_dir']);
}
$form->validate();
$home = '/dns/com/olympe-network/' . security::get('user') . '/' . $form->getValue('dir');
$sql = "UPDATE domain SET homeDirectory = '" . security::encode($home, false) . "' WHERE uid = '{$_POST['id']}'";
$userapi->query($sql, iDatabase::NO_ROW);
// LOG ACTION IN HISTORY
$sql = "SELECT Hostname FROM domain WHERE uid = '{$_POST['id']}'";
$domain = $userapi->query($sql);
$data = array('domain' => $domain['Hostname'], 'dir' => $form->getValue('dir'));
$logger = new logger();
$logger->log($data);
$form->cleanup();
$template->redirect('/panel/domains/edit?done&id=' . $_POST['id']);
示例14: postRating
/**
*
* @param integer $value
* @param integer $date
* @param Pimcore_Model_WebResource_Interface $target
* @param Object_Abstract $user
*/
public static function postRating($value, $comment, $title, $name, $target, $metadata = null, $spamCheck = null)
{
if (!$spamCheck) {
$type = self::getTypeFromTarget($target);
if (!empty($type)) {
$comment = htmlentities(strip_tags($comment), ENT_COMPAT | ENT_HTML401, "UTF-8");
$title = htmlentities(strip_tags($title), ENT_COMPAT | ENT_HTML401, "UTF-8");
$name = htmlentities(strip_tags($name), ENT_COMPAT | ENT_HTML401, "UTF-8");
$comment = $comment == '' ? null : $comment;
$title = $title == '' ? null : $title;
$name = $name == '' ? null : $name;
$rating = new RatingsComments();
$rating->setTarget($target);
$rating->setRating(intval($value));
$rating->setDate(time());
$rating->setType($type);
$rating->setComment($comment);
$rating->setTitle($title);
$rating->setName($name);
$rating->setMetadata($metadata);
if ($target instanceof Object_Abstract) {
$rating->setClassname($target->getO_className());
}
$rating->save();
} else {
logger::log("Rating_Plugin: Could not post rating, unknown resource", Zend_Log::ERR);
}
}
}
示例15: write
/**
* Write to log
*
* @param mixed $object
* @param int $level
* @return void
*/
public function write($object, $level)
{
$this->logger->log($this->get_log_level($level, \Analog::WARNING), $object);
}