本文整理汇总了PHP中logger::write方法的典型用法代码示例。如果您正苦于以下问题:PHP logger::write方法的具体用法?PHP logger::write怎么用?PHP logger::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger
的用法示例。
在下文中一共展示了logger::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cip_db_query
function cip_db_query($query, $report = 'no', $link = 'db_link')
{
// $report manage a way of error reporting and can be:
// no, direct, return, add_session, add
global ${$link}, $logger, $message;
$result = mysql_query($query, ${$link});
if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS == 'true') {
if (!is_object($logger)) {
$logger = new logger();
}
$logger->write($query, 'QUERY');
if ($result === false) {
$logger->write(mysql_error(), 'ERROR');
}
}
if ($result === false) {
$error = 'SQL error :<b>' . mysql_errno() . ' - ' . mysql_error() . '<br>' . $query;
if ($report == 'direct') {
echo $error;
} elseif ($report == 'return') {
$result = $error;
} elseif ($report == 'add') {
$message->add($error, 'error');
} elseif ($report == 'add_session') {
$message->add_session($error, 'error');
}
return false;
} else {
// Только для запросов SELECT, SHOW, EXPLAIN, DESCRIBE
// mysql_query() возвращает указатель на результат запроса
return $result;
}
}
示例2: send_notification
/**
* Sending Push Notification
*/
public function send_notification($registatoin_ids, $message)
{
// include config
include_once 'config.php';
include_once 'logger.php';
$logger = new logger();
// Set POST variables
$url = 'https://android.googleapis.com/gcm/send';
$fields = array('registration_ids' => $registatoin_ids, 'data' => $message);
$headers = array('Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json');
// Open connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
$logger->write("Result+" . $result);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
// Close connection
curl_close($ch);
//echo $result;
}
示例3: log_exception
/**
* Log exception message
*
* @param Exception $error Exception to log
*/
protected function log_exception(Exception $error)
{
if (!isset($this->_logger)) {
$this->_logger = new logger();
}
$this->_logger->write($error->getMessage(), 'ERROR');
}
示例4: tep_db_query
function tep_db_query($query, $link = 'db_link')
{
global ${$link}, $logger;
if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS == 'true') {
if (!is_object($logger)) {
$logger = new logger();
}
$logger->write($query, 'QUERY');
}
$result = mysql_query($query, ${$link}) or tep_db_error($query, mysql_errno(), mysql_error());
if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS == 'true') {
if (mysql_error()) {
$logger->write(mysql_error(), 'ERROR');
}
}
return $result;
}
示例5: xtc_db_query
function xtc_db_query($query, $link = 'db_link')
{
global ${$link}, $logger;
if (STORE_DB_TRANSACTIONS == 'true') {
if (!is_object($logger)) {
$logger = new logger();
}
$logger->write($query, 'QUERY');
}
$result = mysqli_query(${$link}, $query) or xtc_db_error($query, mysqli_errno(${$link}), mysqli_error(${$link}));
if (STORE_DB_TRANSACTIONS == 'true') {
if (mysqli_error(${$link})) {
$logger->write(mysqli_error(${$link}), 'ERROR');
}
}
return $result;
}
示例6: log_exception
/**
* Log exception message
*
* @param Exception $error Exception to log
*/
protected function log_exception(Exception $error)
{
if (!isset($this->_logger)) {
require DIR_WS_CLASSES . 'logger.php';
$this->_logger = new logger();
}
$this->_logger->write((string) $error, 'ERROR');
}
示例7: xos_db_query
function xos_db_query($query, $link = 'db_link')
{
global ${$link}, $logger;
if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS == 'true') {
if (!is_object($logger)) {
$logger = new logger();
}
$logger->write($query, 'QUERY');
}
$result = mysqli_query(${$link}, $query) or xos_db_error($query, mysqli_errno(${$link}), mysqli_error(${$link}));
return $result;
}
示例8: __construct
public function __construct()
{
if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] == "ES_FILE") {
logger::write($GLOBALS['distribution_cfg']['OSS_DOMAIN'] . "/es_file.php");
global $syn_image_ci;
global $curl_param;
//global $syn_image_idx;
$syn_image_idx = 0;
$syn_image_ci = curl_init($GLOBALS['distribution_cfg']['OSS_DOMAIN'] . "/es_file.php");
curl_setopt($syn_image_ci, CURLOPT_RETURNTRANSFER, true);
curl_setopt($syn_image_ci, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($syn_image_ci, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($syn_image_ci, CURLOPT_NOPROGRESS, true);
curl_setopt($syn_image_ci, CURLOPT_HEADER, false);
curl_setopt($syn_image_ci, CURLOPT_POST, TRUE);
curl_setopt($syn_image_ci, CURLOPT_TIMEOUT, 1);
curl_setopt($syn_image_ci, CURLOPT_TIMECONDITION, 1);
$curl_param['username'] = $GLOBALS['distribution_cfg']['OSS_ACCESS_ID'];
$curl_param['password'] = $GLOBALS['distribution_cfg']['OSS_ACCESS_KEY'];
$curl_param['act'] = 2;
}
$GLOBALS['tmpl']->assign("MODULE_NAME", MODULE_NAME);
$GLOBALS['tmpl']->assign("ACTION_NAME", ACTION_NAME);
$GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/page_static_cache/");
$GLOBALS['dynamic_cache'] = $GLOBALS['cache']->get("APP_DYNAMIC_CACHE_" . APP_INDEX . "_" . MODULE_NAME . "_" . ACTION_NAME);
$GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/avatar_cache/");
$GLOBALS['dynamic_avatar_cache'] = $GLOBALS['cache']->get("AVATAR_DYNAMIC_CACHE");
//头像的动态缓存
//输出导航菜单
$nav_list = get_nav_list();
$nav_list = init_nav_list($nav_list);
foreach ($nav_list as $k => $v) {
$nav_list[$k]['sub_nav'] = init_nav_list($v['sub_nav']);
}
$GLOBALS['tmpl']->assign("nav_list", $nav_list);
//输出在线客服与时间
if (app_conf("ONLINE_QQ") != "") {
$qq = unserialize(app_conf("ONLINE_QQ"));
$GLOBALS['tmpl']->assign("online_qq", $qq);
}
//输出页面的标题关键词与描述
$GLOBALS['tmpl']->assign("site_info", get_site_info());
//输出系统文章
$system_article = get_article_list(8, 0, "ac.type_id = 3", "", true);
$GLOBALS['tmpl']->assign("system_article", $system_article['list']);
//输出帮助
$deal_help = get_help();
$GLOBALS['tmpl']->assign("deal_help", $deal_help);
if (MODULE_NAME == "acate" && ACTION_NAME == "index" || MODULE_NAME == "article" && ACTION_NAME == "index" || MODULE_NAME == "cate" && ACTION_NAME == "index" || MODULE_NAME == "comment" && ACTION_NAME == "index" || MODULE_NAME == "help" && ACTION_NAME == "index" || MODULE_NAME == "link" && ACTION_NAME == "index" || MODULE_NAME == "mobile" && ACTION_NAME == "index" || MODULE_NAME == "msg" && ACTION_NAME == "index" || MODULE_NAME == "notice" && ACTION_NAME == "index" || MODULE_NAME == "notice" && ACTION_NAME == "list_notice" || MODULE_NAME == "rec" && ACTION_NAME == "rhot" || MODULE_NAME == "rec" && ACTION_NAME == "rnew" || MODULE_NAME == "rec" && ACTION_NAME == "rbest" || MODULE_NAME == "rec" && ACTION_NAME == "rsale" || MODULE_NAME == "score" && ACTION_NAME == "index" || MODULE_NAME == "space" && ACTION_NAME == "index" || MODULE_NAME == "space" && ACTION_NAME == "fav" || MODULE_NAME == "space" && ACTION_NAME == "fans" || MODULE_NAME == "space" && ACTION_NAME == "focus" || MODULE_NAME == "msg" && ACTION_NAME == "index" || MODULE_NAME == "ss" && ACTION_NAME == "index" || MODULE_NAME == "ss" && ACTION_NAME == "pick" || MODULE_NAME == "sys" && ACTION_NAME == "index" || MODULE_NAME == "sys" && ACTION_NAME == "list_notice" || MODULE_NAME == "vote" && ACTION_NAME == "index") {
set_gopreview();
}
}
示例9: tep_db_query
function tep_db_query($query, $link = 'db_link')
{
global ${$link}, $logger;
if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS == 'true') {
if (!is_object($logger)) {
$logger = new logger();
}
$logger->write($query, 'QUERY');
}
$query = preg_replace('/\\s+/', ' ', $query);
//$start_time = microtime(true);
$result = mysql_query($query, ${$link}) or tep_db_error($query, mysql_errno(), mysql_error());
//$stop_time = microtime(true);
//echo '<br><br>Total Records: '.mysql_num_rows($result);
//echo '<br>Time taken: '.number_format($stop_time-$start_time,4);
if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS == 'true') {
if (mysql_error()) {
$logger->write(mysql_error(), 'ERROR');
}
}
return $result;
}
示例10: send
/**
* Send file to target folder from opened ftp connection
* @param String $filename
* @param String $target_filename
* @return Boolean $result
*/
public function send($filename, $target_filename)
{
$result = false;
$failure1 = false;
$failure2 = false;
$logger = new logger('classes', 'tradebyte_send');
if ($this->ftps_login && (file_exists($filename) && !is_dir($filename))) {
$target_filename_upload = "{$target_filename}.upload";
//MAKE STREAMING FILE AS .upload SO IT WON'T DIRECTLY PROCESSED BY TRADEBYTE
//$status = ftp_put($this->conn_id, $target_filename_upload, $filename, FTP_ASCII);
$local_filesize = filesize($filename);
$res_target = @fopen("ssh2.sftp://{$this->sftp}/{$target_filename_upload}", 'w');
if (!$res_target) {
throw new Exception("Could not create file {$target_filename_upload} on TB server");
$logger->write("Could not create file {$target_filename_upload} on TB server");
$failure1 = true;
}
$res_local = @fopen($filename, 'r');
if (!$res_local) {
throw new Exception("Could not read file {$filename} from local source");
$logger->write("Could not read file {$filename} from local source");
$failure2 = true;
}
if (!$failure1 && !$failure2) {
$written_bytes = stream_copy_to_stream($res_local, $res_target);
if ($written_bytes >= $local_filesize) {
//RENAME xxx.xml.upload TO xxx.xml FOR ALLOWING TRADEBYTE TO PROCESS THE FINISHED UPLOAD XML FILE
//ftp_rename($this->conn_id, $target_filename_upload, $target_filename);
ssh2_sftp_rename($this->sftp, $target_filename_upload, $target_filename);
$result = true;
$logger->write("Success send {$filename} to Tradebyte");
}
}
fclose($res_target);
fclose($res_local);
}
$logger->close();
return $result;
}
示例11: connect_pid
/**
* 连接指定的连接池
* @param unknown_type $pid
*/
function connect_pid($pid, $charset = 'utf8')
{
$dbhost = $GLOBALS['distribution_cfg']['DB_DISTRIBUTION'][$pid]['DB_HOST'];
$dbport = $GLOBALS['distribution_cfg']['DB_DISTRIBUTION'][$pid]['DB_PORT'];
$dbuser = $GLOBALS['distribution_cfg']['DB_DISTRIBUTION'][$pid]['DB_USER'];
$dbpw = $GLOBALS['distribution_cfg']['DB_DISTRIBUTION'][$pid]['DB_PWD'];
$dbname = $GLOBALS['distribution_cfg']['DB_DISTRIBUTION'][$pid]['DB_NAME'];
$dbhost .= ":" . $dbport;
if (PHP_VERSION >= '4.2') {
$this->link_list[$pid] = @mysql_connect($dbhost, $dbuser, $dbpw, true);
} else {
$this->link_list[$pid] = @mysql_connect($dbhost, $dbuser, $dbpw);
}
if ($this->link_list[$pid]) {
$this->version = mysql_get_server_info($this->link_list[$pid]);
/* 如果mysql 版本是 4.1+ 以上,需要对字符集进行初始化 */
if ($this->version > '4.1') {
if ($charset != 'latin1') {
mysql_query("SET character_set_connection={$charset}, character_set_results={$charset}, character_set_client=binary", $this->link_list[$pid]);
}
if ($this->version > '5.0.1') {
mysql_query("SET sql_mode=''", $this->link_list[$pid]);
}
}
if ($dbname) {
if (mysql_select_db($dbname, $this->link_list[$pid]) === false) {
@mysql_close($this->link_list[$pid]);
$this->link_list[$pid] = null;
} else {
return true;
}
} else {
@mysql_close($this->link_list[$pid]);
$this->link_list[$pid] = null;
}
}
logger::write("db_distribution_init_err:" . $pid, logger::ERR, logger::FILE, "db_distribution");
return false;
}
示例12: array
}
$value = $brand_id;
$type = str_replace('set-', '', $type);
} else {
$pbgs = array('value' => $value);
tep_db_perform('products_best_good_settings', $pbgs, 'update', "id={$type}");
}
$result['type'] = $type;
$result['value'] = $value;
ajaxReturn($result);
exit;
} elseif ($_POST['me_action'] == 'RECALCMARGIN') {
set_time_limit(0);
use_class('logger');
$logger = new logger('cron', 'daily-counter-products-matexp');
$logger->write('Margin is recalculated manually by ' . $session_userinfo['username']);
$products = $class_pm->retrieveList("active_status=1");
$pcounter = 0;
foreach ($products as $p) {
$pcounter++;
$class_pm->updateMargin($p['products_id']);
echo '. ';
}
$logger->write($pcounter . ' products updated successfully');
$logger->close();
echo 'DONE!';
exit;
}
}
$sop_mouse_over = array();
$sop_mouse_over['hide_hard'] = 'Report 0 stock for products with Hard Complexity and no depot stock on J&G and all SP Websites';
示例13: array
$api_status_ok = true;
$exchange_rate = array();
$exchange_rate['date'] = date('d.m.Y H:i:s');
$currencies = getAllCurrencies();
foreach ($currencies as $c_from) {
foreach ($currencies as $c_to) {
$key = generateExchangeRateKey($c_from, $c_to);
if ($c_from == $c_to) {
$rate = 1;
} else {
$rate = getExchangeRateOnline($c_from, $c_to);
if ($rate == 0 || $rate === false) {
$api_status_ok = false;
}
}
$exchange_rate[$key] = $rate;
$logger->write('Rate for ' . $key . ': ' . $rate);
}
}
if ($api_status_ok) {
save_config('exchange-rate', $exchange_rate);
$logger->write('Save rate to configuration file');
} else {
$subject = 'IMPORTANT & URGENT: Exchange Rate Cron Failed!';
$content = '<p>Dear All, there seems to be a problem running ' . 'cron/daily-exchange-rate.php! It is not saved and ' . 'last success value is kept.</p>' . '<p>Please check the log and try to rerun it manually.' . ' If you keep receiving this error, create a 2 stars bug report!</p>';
tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subject, $content, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS);
$logger->write('Problem found! A notification is sent to IT Team.');
}
$logger->close();
echo 'Done!';
tep_db_close();
示例14: basename
$sales_report_filename = $config['srlastgeneratedfilename'];
$base_filename = basename($sales_report_filename);
$from_email_name = FROM_EMAIL_NAME;
$from_email_address = FROM_EMAIL_ADDRESS;
$success = array();
$failed = array();
foreach ($recipients as $member) {
$to_name = $member['username'];
$to_email_address = $member['email'];
include '../' . DIR_WS_EMAILS . 'english/sales-report-weekly-products.php';
if (!empty($to_email_address)) {
tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, true);
$success[] = "{$to_name}-{$to_email_address}";
} else {
$failed[] = "{$to_name}-{$to_email_address}";
$logger->write("- Send Email error to {$to_name} ({$to_email_address})");
}
}
}
if (count($success) > 0) {
$msg = "Success send link SR file {$base_filename} to (" . implode(', ', $success) . ")";
$logger->write($msg);
echo "{$msg}\n";
}
if (count($failed) > 0) {
$msg = "Failed send link SR file {$base_filename} to (" . implode(', ', $failed) . ")";
$logger->write($msg);
echo $msg;
}
$logger->close();
tep_db_close();
示例15: array
$num_op = tep_db_num_rows($r_op);
$arr_op = array();
while ($op = tep_db_fetch_array($r_op)) {
$arr_op[] = $op['orders_products_id'];
}
// check total products on jng_sp_orders_items
$r_jo = tep_db_query("SELECT * FROM jng_sp_orders_items WHERE status=8 AND print_count>0");
$num_jo = tep_db_num_rows($r_jo);
$arr_jo = array();
while ($jo = tep_db_fetch_array($r_jo)) {
$arr_jo[] = $jo['jng_sp_orders_items_id'];
}
// total products from both table
$num_total = $num_op + $num_jo;
if ($RUN_UPDATE_QUERY) {
$logger->write("Running in UPDATE mode (orders will be updated for auto reprint)");
if ($num_total == 0) {
$logger->write("No orders found");
} elseif ($num_total <= $max_total_orders_allowed) {
// check if total count less than 10 product then reset query
tep_db_query("UPDATE orders_products SET print_count=0 WHERE status=8 AND print_count>0");
$total_reset_jg = tep_db_affected_rows();
$logger->write("- TOTAL RESET JG = {$total_reset_jg} ");
if ($total_reset_jg > 0) {
$logger->write(implode(", ", $arr_op));
}
tep_db_query("UPDATE jng_sp_orders_items SET print_count=0 WHERE status=8 AND print_count>0");
$total_reset_sp = tep_db_affected_rows();
$logger->write("- TOTAL RESET SP = {$total_reset_sp} ");
if ($total_reset_sp > 0) {
$logger->write(implode(", ", $arr_jo));