本文整理汇总了PHP中log_error函数的典型用法代码示例。如果您正苦于以下问题:PHP log_error函数的具体用法?PHP log_error怎么用?PHP log_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkIfUserExists
static function checkIfUserExists($name, $id)
{
if (posix_getpwnam($name)) {
$username = $name;
$list = lfile("/etc/passwd");
$comment = null;
foreach ($list as $l) {
$l = trim($l);
if (csb($l, "{$username}:")) {
$useri = explode(":", $l);
$comment = $useri[4];
break;
}
}
//dprint($comment . "Hello\n");
if ($comment === uuser::getUserDescription($id)) {
log_error("User {$name} Already Exists. But is of the same domain");
return true;
} else {
log_error("User {$name} Already Exists. But is of NOT of the same domain");
throw new lxexception("User_Exist", 'web_s_uuser_nname', $name);
}
}
return false;
}
示例2: openvpn_resync_gwgroup
function openvpn_resync_gwgroup($gwgroupname = "")
{
global $config;
if (!empty($gwgroupname)) {
if (isset($config['openvpn']['openvpn-server'])) {
foreach ($config['openvpn']['openvpn-server'] as &$settings) {
if ($gwgroupname == $settings['interface']) {
log_error("Resyncing OpenVPN for gateway group " . $gwgroupname . " server " . $settings["description"] . ".");
openvpn_resync('server', $settings);
}
}
}
if (isset($config['openvpn']['openvpn-client'])) {
foreach ($config['openvpn']['openvpn-client'] as &$settings) {
if ($gwgroupname == $settings['interface']) {
log_error("Resyncing OpenVPN for gateway group " . $gwgroupname . " client " . $settings["description"] . ".");
openvpn_resync('client', $settings);
}
}
}
// Note: no need to resysnc Client Specific (csc) here, as changes to the OpenVPN real interface do not effect these.
} else {
log_error("openvpn_resync_gwgroup called with null gwgroup parameter.");
}
}
示例3: render
/**
* Render debug trace
*
*/
public function render($e)
{
Charcoal_ParamTrait::validateException(1, $e);
$message = $this->output($e);
log_error("debug,error,debugtrace", "debugtrace", $message);
return TRUE;
}
示例4: log
public function log($level, &$message) {
switch ($level) {
case LogHelper::LEVEL_DEBUG:
log_debug($message);
break;
case LogHelper::LEVEL_INFO:
log_info($message);
break;
case LogHelper::LEVEL_NOTICE:
log_notice($message);
break;
case LogHelper::LEVEL_WARNING:
log_warn($message);
break;
case LogHelper::LEVEL_ERROR:
log_error($message);
break;
case LogHelper::LEVEL_CRITICAL:
log_critical($message);
break;
case LogHelper::LEVEL_ALERT:
log_alert($message);
break;
case LogHelper::LEVEL_EMERGENCY:
log_emergency($message);
break;
}
}
示例5: template_wraperror
function template_wraperror()
{
global $context, $settings;
log_error('Sorry, [action=' . $context['wraperror_action'] . '] is not supported within this theme.', 'template');
echo '
<img src="', $settings['images_url'], '/404.jpg" alt="" style="cursor: pointer; width: 100%;" onclick="javascript: window.history.back();" />';
}
示例6: request
private function request($data = array())
{
$data['api_token'] = $GLOBALS['CONFIG']['translation']['sync']['poeditor_api_key'];
$data['id'] = $GLOBALS['CONFIG']['translation']['sync']['poeditor_project_id'];
//log_debug($data);
$res = downloadData('http://poeditor.com/api/', $data);
$res = json_decode($res);
if (!$res) {
$this->Lasterror = "Error connecting to the POEditor API";
log_error($this->Lasterror);
return false;
}
if ($res->response->code != 200) {
$this->Lasterror = "POEditor API returned error: " . $res->response->message;
log_error($this->Lasterror, "Details: ", $res);
return false;
}
if (isset($res->details)) {
$edited = (isset($res->details->added) ? $res->details->added : 0) + (isset($res->details->updated) ? $res->details->updated : 0);
if ($edited == 0) {
$this->Lasterror = "POEditor API did not add anything";
log_error($this->Lasterror, "Details:", $res, "Request was:", $data);
return false;
}
}
return $res;
}
示例7: akismet_create_topic
function akismet_create_topic($msg_options, $topic_options, $poster_options)
{
global $modSettings, $scripturl, $smcFunc, $sourcedir;
require $sourcedir . '/Akismet.class.php';
// If the subject is 'akismet-test-123', then mark it as spam (this is a test)
if ($msg_options['subject'] == 'akismet-test-123') {
$spam = true;
} else {
// If the API key has been set
if (isset($modSettings['akismetAPIKey']) && $modSettings['akismetAPIKey'] != "") {
// Set up the Akismet class
$akismet = new Akismet($scripturl, $modSettings['akismetAPIKey']);
$akismet->setAuthor($poster_options['name']);
$akismet->setAuthorEmail($poster_options['email']);
//$akismet->setCommentAuthorURL(""); -- URL's not used in SMF.
$akismet->setContent($msg_options['body']);
if (!empty($topic_options['id'])) {
$akismet->setPermalink($scripturl . '?topic=' . $topicOptions['id']);
}
$akismet->setType('smf-post');
// Now, the moment of truth... Send the post to Akismet
$akismet_return = $akismet->isSpam();
// Was the server down?
if ($akismet_return === 'conn_error') {
// Assume it's not spam. We log an error to the error log later
$spam = false;
// Log it!
if (empty($modSettings['akismetNoLog'])) {
log_error(sprintf($txt['akismet_cant_connect2'], $_POST['guestname'], $scripturl . '?topic=' . $topic . (isset($_REQUEST['msg']) ? '.msg' . $_REQUEST['msg'] : '')));
}
} elseif ($akismet_return === true) {
// Oh, the horror! Someone posted spam to your forum!
$spam = true;
} else {
$spam = false;
}
} else {
// No API key, assume it isn't spam
$spam = false;
}
}
if ($spam) {
// Mark the message as spam and unapprove the post. Post moderation is a big help here. :)
$smcFunc['db_query']('', '
UPDATE {db_prefix}topics
SET spam = 1,
approved = 0,
unapproved_posts = 1
WHERE id_topic = {int:id_topic}', array('id_topic' => $topic_options['id']));
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET approved = 0
WHERE id_msg = {int:id_msg}', array('id_msg' => $msg_options['id']));
// Increase spam count
$smcFunc['db_query']('', '
UPDATE {db_prefix}settings
SET value = value + 1
WHERE variable = {string:akismetCaughtSpam}', array('akismetCaughtSpam' => 'akismetCaughtSpam'));
}
}
示例8: dbtickets_create
function dbtickets_create($len = 32)
{
$table = 'Tickets' . intval($len);
# As in an instance of flamework that has no access to
# its mysql config files and/or the ability to set up
# a dedicated DB server for tickets.
if ($GLOBALS['cfg']['db_enable_poormans_ticketing']) {
# ALTER TABLE tbl_name AUTO_INCREMENT = (n)
# how the fuck do you set the offset from the SQL CLI ?
$rsp = db_tickets_write("SET @@auto_increment_increment=2");
if (!$rsp['ok']) {
log_error("Failed to set auto_increment_increment for {$table}");
return null;
}
$rsp = db_tickets_write("SET @@auto_increment_offset=1");
if (!$rsp['ok']) {
log_error("Failed to set auto_increment_offset for {$table}");
return null;
}
}
$rsp = db_tickets_write("REPLACE INTO {$table} (stub) VALUES ('a')");
if (!$rsp['ok'] || !$rsp['insert_id']) {
log_error("Failed to replace into {$table}");
return null;
}
return $rsp['insert_id'];
}
示例9: error_message
function error_message($userdescription, $description = false)
{
global $infoerror, $errormessage, $config;
$infoerror = true;
$errormessage = $userdescription;
log_error($description);
return;
}
示例10: fatal_handler
function fatal_handler()
{
$error = error_get_last();
if ($error !== NULL) {
log_error($error);
error_response(500, "There is some technical problem. Kindly contact the administrator.");
}
}
示例11: lx_mysql_connect
function lx_mysql_connect($server, $dbadmin, $dbpass)
{
$rdb = mysql_connect('localhost', $dbadmin, $dbpass);
if (!$rdb) {
log_error(mysql_error());
throw new lxException('could_not_connect_to_db_admin', '', '');
}
return $rdb;
}
示例12: log_error_messages
function log_error_messages($link, $throwflag = true)
{
if (mysqli_errno($link)) {
dprint(mysqli_error($link));
log_error(mysqli_error($link));
if ($throwflag) {
throw new lxException('mysql_error', '', mysqli_error($link));
}
}
}
示例13: parse
/**
* Parse a string, and return the result or throw a parser exception
* @param string $str
* @return MC_Parser_Token
*/
public function parse($str)
{
$str = ltrim($str);
list($loc, $tok) = $this->parsePart($str, 0);
if ($loc != strlen($str)) {
log_error("An error occurred: '" . substr($str, $loc) . "' (str={$str})(loc={$loc})", $this);
throw new MC_Parser_ParseError('An error occurred: "' . substr($str, $loc) . '"', $str, $loc);
}
return $tok;
}
示例14: purge_log
function purge_log($account_id)
{
$where = $this->test_account_id($account_id);
$this->db->query("delete from phpgw_log {$where}", __LINE__, __FILE__);
if (isset($this->db->Errno) && $this->db->Errno) {
log_error(array('text' => 'Failed to delete log records from database using where clause of %1. DB errno %2: message %3', 'p1' => $where, 'p2' => $this->db->Errno, 'p3' => $this->db->Error, 'file' => __FILE__, 'line' => __LINE__));
return false;
}
return true;
}
示例15: lx_mysql_connect
function lx_mysql_connect($server, $dbadmin, $dbpass)
{
// TODO: REPLACE MYSQL_CONNECT OR REMOVE FUNCTION
$rdb = mysqli_connect('localhost', $dbadmin, $dbpass);
if (!$rdb) {
log_error(mysqli_error($rdb));
throw new lxException('could_not_connect_to_db_admin', '', '');
}
return $rdb;
}