本文整理汇总了PHP中logWrite函数的典型用法代码示例。如果您正苦于以下问题:PHP logWrite函数的具体用法?PHP logWrite怎么用?PHP logWrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logWrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shutdown
function shutdown($msg = '')
{
global $ircNetworks, $module, $log;
logWrite(L_SYSTEM, sprintf('[SYSTEM] Shutting down neotor%s', !empty($msg) ? ': ' . $msg : ''));
// Kill all irc-connections
foreach ($ircNetworks as $key => $value) {
$ircNetworks[$key]->quit($msg);
}
// Close all logs
if (!is_array($log)) {
$log = array();
}
foreach ($log as $key => $value) {
if ($key > 0) {
$log[$key]->close();
}
}
// Unload all modules
if (!is_array($module)) {
$module = array();
}
foreach ($module as $key => $value) {
$value->forceUnload();
}
// Going down
exit;
}
示例2: getKey
public function getKey()
{
//时间戳
$ts = time();
//随机数
$tr = $this->ci->ucc->genRandomInt(5);
// var_dump($tr.($ts+$tr));
//拼接返回
$this->ci->load->helper("dblog");
logWrite("WCF genKey", print_r(array("ts" => $ts, "tr" => $tr), true), 1, "", 0, 0);
return $tr . ($ts + $tr);
}
示例3: logPushMsg
function logPushMsg($msg, $immediate_write = true, $do_echo = FALSE)
{
global $msg_buf;
if (!isset($msg_buf)) {
$msg_buf = '';
}
if (is_array($msg)) {
$msg = print_r($msg, TRUE);
}
if (defined('PKG_SYSBOOT') & $do_echo) {
echo $msg;
}
$msg_buf .= "{$msg}\n---[MSG END]---\n\n";
if ($immediate_write) {
logWrite();
}
}
示例4: query
public function query($query)
{
if (!isset($this->db) || !mysql_ping($this->db)) {
$this->db = mysql_connect(CONFIG_mysql_server, CONFIG_mysql_username, CONFIG_mysql_password);
mysql_select_db(CONFIG_mysql_database, $this->db);
}
if (!($q = mysql_query($query, $this->db))) {
if (mysql_errno($this->db) == 2006) {
mysql_close($this->db);
$this->db = mysql_connect(CONFIG_mysql_server, CONFIG_mysql_username, CONFIG_mysql_password);
mysql_select_db(CONFIG_mysql_database, $this->db);
if ($q = mysql_query($query, $this->db)) {
$f = true;
}
}
if (empty($f)) {
logWrite(L_ERROR, "[QABOT] Query Failed (" . mysql_errno($this->db) . ' ' . mysql_error($this->db) . "): {$query}\n");
}
}
return $q;
}
示例5: Zend_Loader_Autoloader_Resource
$loader = new Zend_Loader_Autoloader_Resource(array('basePath' => $apppath . '/application/', 'namespace' => 'Application'));
// Name, path, namepsace
$loader->addResourceType('model', 'models', 'Model');
// Get our config file
$config = new Zend_Config_Ini($apppath . '/application/configs/application.ini');
Zend_Registry::set('config', $config->production);
// Because our models need it this way
// Get the Delivery Report model
$timestamp = date('Y-m-d H:i:s');
// Log the start of this read
logWrite("####################################");
logWrite("Begin store memcache optouts: {$timestamp}");
logWrite("------------------------------------");
$inb = new Application_Model_Smsinbound();
$inb->optoutsListFromInboundToMemcache();
$endofset = date('Y-m-d H:i:s');
logWrite("End of storing optouts into memcache: {$endofset}");
logWrite("------------------------------------");
return 0;
/**
* Simply writes a log message line to the log file
*
* @param string $msg The message to write
*/
function logWrite($msg)
{
global $logfile;
$fh = fopen($logfile, 'a');
fwrite($fh, "{$msg}\n");
fclose($fh);
}
示例6: Application_Model_Message
/*Memcache server: BDAYCLUB info stores in the memcache memory*/
$msgobj = new Application_Model_Message();
$msgobj->addMemcahceBdclub();
/*end of memcache server use*/
$dataObj = new Application_Model_DataReporting();
$rst = $dataObj->allphonenumbers();
if ($rst) {
$log = "Rows inserted: {$rst}";
logWrite($log);
} else {
logWrite("No data inserted!!");
}
// Set up our current timestamp for closing out
$timestamp = date('Y-m-d H:i:s');
// Log the end of this send
logWrite("\n---------------------");
logWrite("End of inserting: {$timestamp}");
logWrite("**********************************\n");
return 0;
/**
* Simply writes a log message line to the log file
*
* @param string $msg The message to write
*/
function logWrite($msg)
{
global $logfile;
$fh = fopen($logfile, 'a');
fwrite($fh, "{$msg}\n");
fclose($fh);
}
示例7: sendweeklyAction1
public function sendweeklyAction1()
{
$weeklyreport = new Application_Model_Report();
$sendReportsTo = $weeklyreport->sendRportTo();
$queueCount = count($sendReportsTo);
$sendCount = 0;
if (is_array($sendReportsTo)) {
if (!empty($sendReportsTo)) {
foreach ($sendReportsTo as $user) {
$mail = new Zend_Mail();
$mail->setBodyText('Please see the weekly report:');
$mail->setFrom('reports@textmunication.com', 'Textmunication.com');
$mail->addTo($user['email'], 'Joseph Saunders');
$mail->addCc('wais@textmunication.com', 'Wais Asefi');
//$mail->addCc('robert.anthony.gonzalez@gmail.com', 'Robert Gonzalez');
$mail->setSubject('Weekly Reports');
// Get the Excel model
$excel = new Application_Model_Excel();
if ($weeklyreport->checkAdminUser($user['id']) and $user['id'] != 187) {
if (isset($user['edituser'])) {
$excelDataArray = $weeklyreport->getWeeklyReportByEditUser($user['edituser']);
//echo "single"; print_r($excelDataArray); exit;
$date = date('Ymd');
$excelFileName = "weeklyreport_pollo" . $user['edituser'] . '_' . $date;
logWrite("Creating the Excel spreadsheets");
$excel = new Application_Model_Excel();
$excelFile = $excel->create($excelDataArray, $excelFileName);
logWrite("Attaching the spreadsheets");
$at = $mail->createAttachment(file_get_contents($excelFile['path']));
$at->filename = $excelFile['name'];
} else {
$excelDataArray = $weeklyreport->getWeeklyReport($user['id']);
$date = date('Ymd');
$excelFileName = "weeklyreport_clientid" . $user['id'] . '_' . $date;
$excel = new Application_Model_Excel();
$excelFile = $excel->create($excelDataArray, $excelFileName);
$at = $mail->createAttachment(file_get_contents($excelFile['path']));
$at->filename = $excelFile['name'];
}
} else {
// Get the subscriber datasets
$excelDataArray = $weeklyreport->getWeeklyReport();
//echo "<pre>"; print_r($excelDataArray); exit;
// Get a date stamp for the file
$date = date('Ymd');
// Create our file names
$excelFileName = "weeklyreport_clientid" . $user['id'] . '_' . $date;
// Log the steps
//logWrite("Creating the Excel spreadsheets");
// Make the Excel files for each day
$excelFile = $excel->create($excelDataArray, $excelFileName);
$at = $mail->createAttachment(file_get_contents($excelFile['path']));
$at->filename = $excelFile['name'];
}
// Log the steps
//logWrite("Preparing to send...");
// Send it off
if (!$mail->send()) {
echo "MESSAGE NOT SENT";
} else {
echo "Message sent";
}
}
} else {
$this->error = "No reports to send";
}
} else {
$this->error = "Send to report was not properly fetched";
}
}
示例8: gotRaw
/**
* Called whenever raw data is received from the server.
* Calls parseCommand() and all attach():ed methods
*
* @param string $data The data that was received
*
* @return void
*/
public function gotRaw($data)
{
$extra = $this->parseCommand($data);
extract($extra);
foreach ($this->attached as $id => $val) {
list($filter, $method, $regexp) = $val;
if (empty($filter) || in_array($func, $filter)) {
if (!empty($regexp)) {
if (preg_match($regexp, $msg, $extra['regexp']) == 0) {
continue;
}
}
try {
call_user_func_array($method, array($this, $data, $extra));
} catch (Exception $e) {
logWrite(L_ERROR, "Uncaught exception from module: " . $e->getMessage());
}
}
}
}
示例9: array
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$refreshIDs = array();
while ($res = $stmt->fetch()) {
$refreshIDs[$res['id']] = '';
}
//print_r($refreshIDs);
logWrite("Изменения обнаружены в: " . count($refreshIDs) . " товарах");
// TODO: Сохраняем сериализованный массив ресурсов с изменениями в файл refresh.spb.dat
// А может и не надо...
// Заливаем новые данные в рабочую таблицу ms_products
$sql = "UPDATE `modx_ms2_products` as m, temp_import_spb as t, `modx_site_content` as c\nSET m.quantity=t.quantity,\nm.weight=t.weight,\nm.price=t.price,\nm.old_price=t.old_price\nWHERE m.article=t.article\nAND m.id=c.id\nAND c.context_key='web'";
$res = $db->exec($sql);
logWrite('Запись новых данных: ' . $res . ' строк внесено');
/**/
//------------- САНКТ-ПЕТЕРБУРГ ВЫПОЛНЕНО ---------------------------------------------------------------------/
// Избирательная чистка Кэша
//print_r($refreshIDs);
foreach ($refreshIDs as $id => $val) {
//$id=79;
$resource = $modx->getObject('modResource', $id);
$cacheKey = $resource->getCacheKey();
$modx->cacheManager->refresh(array('resource' => array('key' => $cacheKey)));
}
// Финиш
logWrite('затраченное время: ' . (microtime(true) - $modx->startTime) . ' сек.');
logWrite('');
if (DEBUG) {
print "</pre>";
}
fwrite($fLastLog, $template_end);
exit(0);
示例10: halt
/**
* 错误输出
* @param mixed $error 错误
* @return void
*/
function halt($error)
{
$e = array();
if (APP_DEBUG) {
//APP_DEBUG || IS_CLI
//调试模式下输出错误信息
if (!is_array($error)) {
$trace = debug_backtrace();
$e['message'] = $error;
$e['file'] = $trace[0]['file'];
$e['line'] = $trace[0]['line'];
ob_start();
debug_print_backtrace();
$e['trace'] = ob_get_clean();
} else {
$e = $error;
}
//兼容php其他运行模式
// if(IS_CLI){
// exit(iconv('UTF-8','gbk',$e['message']).PHP_EOL.'FILE: '.$e['file'].'('.$e['line'].')'.PHP_EOL.$e['trace']);
// }
} else {
//否则定向到错误页面
$error_page = C('ERROR_PAGE');
if (!empty($error_page)) {
include $error_page;
exit;
} else {
$message = is_array($error) ? $error['message'] : $error;
$e['message'] = C('SHOW_ERROR_MSG') ? $message : C('ERROR_MESSAGE');
}
}
logWrite($e['message'] . "\n\r" . $e['file'] . "\n\r" . $e['line'] . "\n\r");
// 包含异常页面模板
$exceptionFile = LWH_PATH . 'View/lwh_exception.html';
include $exceptionFile;
exit;
}
示例11: get
function get($data)
{
$data = str_replace("\r", "", str_replace("\n", "", $data));
if (!empty($data)) {
$this->idle = time();
// Reset idle-counter
if ($this->auth['authed'] == 0) {
if (empty($this->auth['username'])) {
$this->auth['username'] = $data;
$this->put('Password: ', 1, 1);
return;
} else {
/*
FIXME:
Password entered, check against database.this
*/
if ($this->auth['username'] != CONFIG_telnet_username && $this->auth['password'] != CONFIG_telnet_password) {
$this->quit();
}
$this->put('Auth ok.', 1);
$this->put(sprintf('%s%s (%s) logged in.', timestamp(), $this->auth['username'], $this->host), 1);
$this->auth['authed'] = 1;
$this->auth['password'] = $data;
logWrite(L_TELNET, sprintf('[TELNET:%d] User \'%s\' logged in.', 0, $this->auth['username']));
return;
}
} else {
$cmd = '';
$args = '';
if (strstr($data, ' ')) {
list($cmd, $args) = explode(' ', $data, 2);
} else {
$cmd = $data;
}
$this->exec($cmd, $args);
return;
}
}
}
示例12: touch
if (!file_exists($config['system']['pidfile'])) {
touch($config['system']['pidfile']);
}
$pidfile = fopen($config['system']['pidfile'], 'w');
fwrite($pidfile, $pid);
exit;
}
} else {
logWrite(L_DEBUG, sprintf('[DEBUG] Entering debug-mode'));
if (!defined("DEBUG")) {
define("DEBUG", true);
}
}
if (function_exists("pcntl_signal")) {
pcntl_signal(SIGTERM, "sigHandler");
pcntl_signal(SIGHUP, "sigHandler");
}
$ircNetworks = $writeStreams = $openStreams = $openFiles = array();
if (defined('DEBUG')) {
logOpen('php://stdout', L_DEBUG | L_SYSTEM | L_ERROR | L_TELNET | L_PRIVMSG | L_IRCALL);
if (PHP_OS !== 'WINNT' && ($tmpfp = fopen('php://stdin', 'r'))) {
$openFiles['console'] = array('socket' => $tmpfp, 'type' => 'console');
$console = new stdin($tmpfp);
unset($tmpfp);
}
logWrite(L_DEBUG, sprintf('[DEBUG] Started neotor %s.', $version));
}
// logOpen('logs/g33k.se.log', L_CHANNEL, '#g33k.se');
if (function_exists("irc_open_sockets")) {
irc_open_sockets();
}
示例13: elseif
if (empty($opt) || !file_exists('modules/' . $mod . '.php')) {
continue;
} elseif ($opt == 1) {
include_once 'modules/' . $mod . '.php';
$netObj[$mod] = $mod;
} else {
include_once 'modules/' . $mod . '.php';
if (!isset($netObj[$opt]) || !is_array($netObj[$opt])) {
$netObj[$opt] = array();
}
$netObj[$opt][$mod] = $mod;
}
}
}
/*
* Start bot
*/
include_once SPATH . 'start.php';
// Initiate startup-script.
$init = 0;
// Disable all init-codes.
include_once SPATH . 'main.php';
// Initiate while-loop.
/*
* If the script got this far, an error ocurred.
*/
if (function_exists('logWrite')) {
logWrite(L_ERROR | L_DEBUG, "[error] Script ended without reason.\n");
} else {
exit(timestamp() . " [error] Script ended without reason.\n");
}
示例14: logWrite
}
//$output.="REQUEST_TIME ".$_SERVER['REQUEST_TIME']."\n";
if (!empty($info->city->name_ru)) {
$output .= "Город\t\t\t" . $info->city->name_ru;
}
if (!empty($info->region->name_ru)) {
$output .= " - регион: " . $info->region->name_ru;
}
if (!empty($info->country->name_ru)) {
$output .= " - " . $info->country->name_ru;
}
$output .= "\n";
if (!empty($info->request)) {
$output .= "Запрос к API Sypex\t" . $info->request . "\n";
}
logWrite($output, $fhBuf);
//logWrite(microtime(true) - $startTime, $fhBuf);
// Закрываем файл
fflush($fhBuf) or die($php_errormsg);
flock($fhBuf, LOCK_UN) or die($php_errormsg);
fclose($fhBuf) or die($php_errormsg);
}
unset($fhBuf);
// Файл освобождён
if (DEBUG) {
print "</pre>";
}
// Template caching system
if (!DEBUG) {
print getActualCache($template_cache_filename, 86400, $template_source_path);
}
示例15: logWrite
logWrite("------------------------------------");
//if ($message->queueBirthDayMessage()) {
// logWrite("Birth day messages are queueing.");
//} else {
// logWrite("Birth day messages can not be queued.");
//}
$msgobj = new Application_Model_Message();
//$arb = $msgobj->addMemcahceBdclub();
$mobj = memcache_connect('10.179.252.160', 11211);
$msgbody = $mobj->get('1386');
echo '<pre>';
print_r($msgbody);
// Set up our current timestamp for closing out
$timestamp = date('Y-m-d H:i:s');
// Log the end of this send
logWrite("\n---------------------");
logWrite("Process complete\nEnd birth day message set: {$timestamp}");
logWrite("####################################\n");
return 0;
/**
* Simply writes a log message line to the log file
*
* @param string $msg The message to write
*/
function logWrite($msg)
{
global $logfile;
$fh = fopen($logfile, 'a');
fwrite($fh, "{$msg}\n");
fclose($fh);
}