本文整理汇总了PHP中AJXP_Logger::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Logger::getInstance方法的具体用法?PHP AJXP_Logger::getInstance怎么用?PHP AJXP_Logger::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Logger
的用法示例。
在下文中一共展示了AJXP_Logger::getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
* Log a message if the logQueries property is true.
*
* @param $textMessage String text of the message to log
* @param $severityLevel Integer constant of the logging severity
* @return null
*/
public function log($textMessage, $severityLevel = LOG_LEVEL_DEBUG)
{
if ($this->debugEnabled) {
$logger = AJXP_Logger::getInstance();
$logger->write($textMessage, $severityLevel);
}
}
示例2: listLogFiles
function listLogFiles($dir)
{
$logger = AJXP_Logger::getInstance();
$parts = explode("/", $dir);
if (count($parts) > 4) {
print '<columns switchDisplayMode="list" switchGridMode="grid">
<column messageString="Date" attributeName="date" sortType="Date" width="10%"/>
<column messageString="I.P." attributeName="ip" sortType="String"/>
<column messageString="Level" attributeName="level" sortType="String"/>
<column messageString="User" attributeName="user" sortType="String"/>
<column messageString="Action" attributeName="action" sortType="String"/>
<column messageString="Params" attributeName="params" sortType="String"/>
</columns>';
$date = $parts[count($parts) - 1];
$logger->xmlLogs($date, "tree");
} else {
print '<columns switchGridMode="filelist"><column messageString="File Date" attributeName="ajxp_label" sortType="String"/></columns>';
$logger->xmlListLogFiles("tree", count($parts) > 2 ? $parts[2] : null, count($parts) > 3 ? $parts[3] : null);
}
}
示例3: upgradeDB
public function upgradeDB()
{
$confDriver = ConfService::getConfStorageImpl();
$authDriver = ConfService::getAuthDriverImpl();
$logger = AJXP_Logger::getInstance();
if (is_a($confDriver, "sqlConfDriver")) {
$conf = AJXP_Utils::cleanDibiDriverParameters($confDriver->getOption("SQL_DRIVER"));
if (!is_array($conf) || !isset($conf["driver"])) {
return "Nothing to do";
}
switch ($conf["driver"]) {
case "sqlite":
case "sqlite3":
$ext = ".sqlite";
break;
case "postgre":
$ext = ".pgsql";
break;
case "mysql":
$ext = is_file($this->workingFolder . "/" . $this->dbUpgrade . ".mysql") ? ".mysql" : ".sql";
break;
default:
return "ERROR!, DB driver " . $conf["driver"] . " not supported yet in __FUNCTION__";
}
$file = $this->dbUpgrade . $ext;
if (!is_file($this->workingFolder . "/" . $file)) {
return "Nothing to do.";
}
$sqlInstructions = file_get_contents($this->workingFolder . "/" . $file);
$parts = array_map("trim", explode("/* SEPARATOR */", $sqlInstructions));
$results = array();
$errors = array();
dibi::connect($conf);
dibi::begin();
foreach ($parts as $sqlPart) {
if (empty($sqlPart)) {
continue;
}
try {
dibi::nativeQuery($sqlPart);
$results[] = $sqlPart;
} catch (DibiException $e) {
$errors[] = $sqlPart . " (" . $e->getMessage() . ")";
}
}
dibi::commit();
dibi::disconnect();
if (!count($errors)) {
return "Database successfully upgraded";
} else {
return "Database upgrade failed. <br>The following statements were executed : <br>" . implode("<br>", $results) . ",<br><br> The following statements failed : <br>" . implode("<br>", $errors) . "<br><br> You should manually upgrade your DB.";
}
}
}
示例4: listLogFiles
public function listLogFiles($dir, $root = NULL, $hash = null, $returnNodes = false)
{
$dir = "/{$dir}";
$allNodes = array();
$logger = AJXP_Logger::getInstance();
$parts = explode("/", $dir);
if (count($parts) > 4) {
$config = '<columns switchDisplayMode="list" switchGridMode="list" template_name="ajxp_conf.logs">
<column messageId="ajxp_conf.17" attributeName="date" sortType="MyDate" defaultWidth="18%"/>
<column messageId="ajxp_conf.18" attributeName="ip" sortType="String" defaultWidth="5%"/>
<column messageId="ajxp_conf.19" attributeName="level" sortType="String" defaultWidth="10%"/>
<column messageId="ajxp_conf.20" attributeName="user" sortType="String" defaultWidth="5%"/>
<column messageId="ajxp_conf.124" attributeName="source" sortType="String" defaultWidth="5%"/>
<column messageId="ajxp_conf.21" attributeName="action" sortType="String" defaultWidth="7%"/>
<column messageId="ajxp_conf.22" attributeName="params" sortType="String" defaultWidth="50%"/>
</columns>';
if (!$returnNodes) {
AJXP_XMLWriter::sendFilesListComponentConfig($config);
}
$date = $parts[count($parts) - 1];
$logger->xmlLogs($dir, $date, "tree", "/" . $root . "/logs");
} else {
if (!$returnNodes) {
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.16" attributeName="ajxp_label" sortType="String"/></columns>');
}
$nodes = $logger->xmlListLogFiles("tree", count($parts) > 2 ? $parts[2] : null, count($parts) > 3 ? $parts[3] : null, "/" . $root . "/logs", false);
foreach ($nodes as $last => $nodeXML) {
if (is_numeric($last) && $last < 10) {
$last = "0" . $last;
}
$key = "/{$root}{$dir}/{$last}";
if (in_array($key, $this->currentBookmarks)) {
$nodeXML = str_replace("/>", ' ajxp_bookmarked="true" overlay_icon="bookmark.png"/>', $nodeXML);
}
$allNodes[$key] = $nodeXML;
if (!$returnNodes) {
print $nodeXML;
}
}
}
return $allNodes;
}
示例5: realpath
$use_https = false;
/**************************************************/
/* MAX NUMBER CHARS FOR FILE AND DIRECTORY NAMES
/**************************************************/
$max_caracteres = 50;
/*************************************************/
/* WHEN SET, USE SYSTEM CODE TO GET FILESIZE.
/* Enable this on 32bits machine, to overcome PHP
/* 4GB limit on file size. This requires shell_exec
/* permission on linux, and fork permission on
/* windows. Under Windows, it's faster to install
/* COM PHP Extension.
/*************************************************/
$allowRealSizeProbing = true;
/**************************************************/
/* ADVANCED : DO NOT CHANGE THESE VARIABLES BELOW
/**************************************************/
$installPath = realpath(dirname(__FILE__) . "/../..");
define("INSTALL_PATH", $installPath);
define("USERS_DIR", $installPath . "/server/users");
define("SERVER_ACCESS", "content.php");
define("ADMIN_ACCESS", "admin.php");
define("IMAGES_FOLDER", "client/images");
define("CLIENT_RESOURCES_FOLDER", "client");
define("SERVER_RESOURCES_FOLDER", "server/classes");
define("DOCS_FOLDER", "client/doc");
define("TESTS_RESULT_FILE", $installPath . "/server/conf/diag_result.php");
define("OLD_USERS_DIR", $installPath . "/bookmarks");
define("INITIAL_ADMIN_PASSWORD", "admin");
$logger = AJXP_Logger::getInstance();
$logger->initStorage(INSTALL_PATH . "/server/logs/");
示例6: listLogFiles
function listLogFiles($dir, $root = NULL)
{
$dir = "/{$dir}";
$logger = AJXP_Logger::getInstance();
$parts = explode("/", $dir);
if (count($parts) > 4) {
$config = '<columns switchDisplayMode="list" switchGridMode="grid" template_name="ajxp_conf.logs">
<column messageId="ajxp_conf.17" attributeName="date" sortType="MyDate" defaultWidth="10%"/>
<column messageId="ajxp_conf.18" attributeName="ip" sortType="String" defaultWidth="10%"/>
<column messageId="ajxp_conf.19" attributeName="level" sortType="String" defaultWidth="10%"/>
<column messageId="ajxp_conf.20" attributeName="user" sortType="String" defaultWidth="10%"/>
<column messageId="ajxp_conf.21" attributeName="action" sortType="String" defaultWidth="10%"/>
<column messageId="ajxp_conf.22" attributeName="params" sortType="String" defaultWidth="50%"/>
</columns>';
AJXP_XMLWriter::sendFilesListComponentConfig($config);
$date = $parts[count($parts) - 1];
$logger->xmlLogs($dir, $date, "tree", $root . "/logs");
} else {
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.16" attributeName="ajxp_label" sortType="String"/></columns>');
$logger->xmlListLogFiles("tree", count($parts) > 2 ? $parts[2] : null, count($parts) > 3 ? $parts[3] : null, $root . "/logs");
}
}
示例7: logAction
function logAction($action, $params = array())
{
$logger = AJXP_Logger::getInstance();
$message = "{$action}\t";
if (count($params)) {
$message .= $logger->arrayToString($params);
}
$logger->write($message, LOG_LEVEL_INFO);
}