本文整理汇总了PHP中Logging::fetch_logs方法的典型用法代码示例。如果您正苦于以下问题:PHP Logging::fetch_logs方法的具体用法?PHP Logging::fetch_logs怎么用?PHP Logging::fetch_logs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logging
的用法示例。
在下文中一共展示了Logging::fetch_logs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Tools
$Tools = new Tools($Database);
$Log = new Logging($Database);
$Result = new Result();
}
# user must be authenticated
$User->check_user_session();
# if direct request that redirect to tools page
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
header("Location: " . create_link("tools", "logs"));
}
# if syslog print
if ($User->settings->log == "syslog") {
$Result->show("warning", _("Log files are sent to syslog"));
} else {
# print last 5 access logs
$logs = $Log->fetch_logs(5, NULL, NULL, NULL, 0, 0, 0);
print "<table class='table table-condensed table-hover table-top'>";
# headers
print "<tr>";
print "\t<th>" . _('Severity') . "</th>";
print "\t<th>" . _('Command') . "</th>";
print "\t<th>" . _('Date') . "</th>";
print "\t<th>" . _('Username') . "</th>";
print "</tr>";
# logs
foreach ($logs as $log) {
# cast
$log = (array) $log;
# reformat severity
if ($log['severity'] == 0) {
$log['severityText'] = _("Info");
示例2:
$logCount = 40;
//set severity queries
$_POST['InformationalQuery'] = @$_POST['Informational'] == _("Informational") ? 0 : 10;
$_POST['NoticeQuery'] = @$_POST['Notice'] == _("Notice") ? 1 : 10;
$_POST['WarningQuery'] = @$_POST['Warning'] == _("Warning") ? 1 : 10;
//get highest lastId */
$highestId = $Log->log_fetch_highest_id();
if (empty($_POST['lastId']) || $_POST['lastId'] == "undefined") {
$_POST['lastId'] = $highestId;
}
//set empty direction
if (!isset($_POST['direction'])) {
$_POST['direction'] = "";
}
/* get requested logs */
$logs = $Log->fetch_logs($logCount, $_POST['direction'], $_POST['lastId'], $highestId, $_POST['InformationalQuery'], $_POST['NoticeQuery'], $_POST['WarningQuery']);
$x = 0;
foreach ($logs as $log) {
//cast
$log = (array) $log;
if ($x < $logCount) {
//set classes based on severity
if ($log['severity'] == 0) {
$log['severityText'] = _("Informational");
$color = "success";
} else {
if ($log['severity'] == 1) {
$log['severityText'] = _("Notice");
$color = "warning";
} else {
$log['severityText'] = _("Warning");
示例3: Tools
$Tools = new Tools($Database);
$Log = new Logging($Database);
$Result = new Result();
}
# user must be authenticated
$User->check_user_session();
# if direct request that redirect to tools page
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
header("Location: " . create_link("tools", "logs"));
}
# if syslog print
if ($User->settings->log == "syslog") {
$Result->show("warning", _("Log files are sent to syslog"));
} else {
# print last 5 access logs
$logs = $Log->fetch_logs(5, NULL, NULL, NULL, "off", "on", "on");
print "<table class='table table-condensed table-hover table-top'>";
# headers
print "<tr>";
print "\t<th>" . _('Severity') . "</th>";
print "\t<th>" . _('Command') . "</th>";
print "\t<th>" . _('Date') . "</th>";
print "\t<th>" . _('Username') . "</th>";
print "</tr>";
# logs
foreach ($logs as $log) {
# cast
$log = (array) $log;
# reformat severity
if ($log['severity'] == 0) {
$log['severityText'] = _("Info");
示例4: elseif
$logCount = 40;
//set severity queries
$informational = @$_POST['Informational'] == "Informational" ? "on" : "off";
$notice = @$_POST['Notice'] == "Notice" ? "on" : "off";
$warning = @$_POST['Warning'] == "Warning" ? "on" : "off";
//get highest lastId */
$highestId = $Log->log_fetch_highest_id();
if (empty($_POST['lastId']) || $_POST['lastId'] == "undefined") {
$_POST['lastId'] = $highestId;
}
//set empty direction
if (!isset($_POST['direction'])) {
$_POST['direction'] = "";
}
/* get requested logs */
$logs = $Log->fetch_logs($logCount, $_POST['direction'], $_POST['lastId'], $highestId, $informational, $notice, $warning);
$x = 0;
foreach ($logs as $log) {
//cast
$log = (array) $log;
//set classes based on severity
if ($log['severity'] == 0) {
$log['severityText'] = _("Informational");
$color = "success";
} elseif ($log['severity'] == 1) {
$log['severityText'] = _("Notice");
$color = "warning";
} elseif ($log['severity'] == 2) {
$log['severityText'] = _("Warning");
$color = "danger";
} else {
示例5: Tools
$Tools = new Tools($Database);
$Log = new Logging($Database);
$Result = new Result();
}
# user must be authenticated
$User->check_user_session();
# if direct request that redirect to tools page
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
header("Location: " . create_link("tools", "logs"));
}
# if syslog print
if ($User->settings->log == "syslog") {
$Result->show("warning", _("Log files are sent to syslog"));
} else {
# print last 5 access logs
$logs = $Log->fetch_logs(5, NULL, NULL, NULL, 1, 2, 2);
print "<table class='table table-condensed table-hover table-top'>";
# headers
print "<tr>";
print "\t<th>" . _('Severity') . "</th>";
print "\t<th>" . _('Command') . "</th>";
print "\t<th>" . _('Date') . "</th>";
print "\t<th>" . _('Username') . "</th>";
print "</tr>";
# logs
foreach ($logs as $log) {
# cast
$log = (array) $log;
# reformat severity
if ($log['severity'] == 0) {
$log['severityText'] = _("Info");