本文整理汇总了PHP中Log类的典型用法代码示例。如果您正苦于以下问题:PHP Log类的具体用法?PHP Log怎么用?PHP Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Autoload $objAutoload)
{
$_SESSION['POST'] = serialize($_POST);
$_SESSION['GET'] = serialize($_GET);
parent::__construct($objAutoload);
/* @var $objContent Content */
$objContent = unserialize($_SESSION['objContent']);
$arrayFiles = $objAutoload->getClassName();
$module = ucfirst($this->getModule());
$action = ucfirst($this->getAction());
if (empty($module) && empty($action)) {
$this->redirectIndex(MODULE_DEFAULT, ACTION_DEFAULT, array());
exit;
}
$module = empty($module) ? MODULE_DEFAULT : $module;
$action = empty($action) ? ACTION_DEFAULT : $action;
$className = "Action" . $module;
if (!in_array($className . ".php", $arrayFiles)) {
echo ERRO_404;
$log = new Log();
$log->setLog(__FILE__, $className . ' It was found in line ' . __LINE__ . ' - Module [' . $module . '] does not exist');
return false;
}
$_SESSION['objContent'] = serialize($objContent);
$preActionClass = new ActionGeneral();
$preLoad = new PreLoad($preActionClass);
$actionClass = new $className();
$load = new Load($actionClass, $action, $module);
}
示例2: log
/**
*
* Faz log de uma ação do usuário
* @param string $message
*/
public static function log($message)
{
$log = new Log();
$log->cod_pessoa = Yii::app()->user->getId();
$log->mensagem = $message;
$log->save();
}
示例3: ShowChatConfigPage
function ShowChatConfigPage()
{
global $LNG, $USER;
$CONF = Config::getAll(NULL, 1);
if (!empty($_POST)) {
$config_before = array('chat_closed' => $CONF['chat_closed'], 'chat_allowchan' => $CONF['chat_allowchan'], 'chat_allowmes' => $CONF['chat_allowmes'], 'chat_allowdelmes' => $CONF['chat_allowdelmes'], 'chat_logmessage' => $CONF['chat_logmessage'], 'chat_nickchange' => $CONF['chat_nickchange'], 'chat_botname' => $CONF['chat_botname'], 'chat_channelname' => $CONF['chat_channelname']);
$chat_allowchan = isset($_POST['chat_allowchan']) && $_POST['chat_allowchan'] == 'on' ? 1 : 0;
$chat_allowmes = isset($_POST['chat_allowmes']) && $_POST['chat_allowmes'] == 'on' ? 1 : 0;
$chat_allowdelmes = isset($_POST['chat_allowdelmes']) && $_POST['chat_allowdelmes'] == 'on' ? 1 : 0;
$chat_logmessage = isset($_POST['chat_logmessage']) && $_POST['chat_logmessage'] == 'on' ? 1 : 0;
$chat_nickchange = isset($_POST['chat_nickchange']) && $_POST['chat_nickchange'] == 'on' ? 1 : 0;
$chat_closed = isset($_POST['chat_closed']) && $_POST['chat_closed'] == 'on' ? 1 : 0;
$chat_channelname = HTTP::_GP('chat_channelname', '', true);
$chat_botname = HTTP::_GP('chat_botname', '', true);
$config_after = array('chat_closed' => $chat_closed, 'chat_allowchan' => $chat_allowchan, 'chat_allowmes' => $chat_allowmes, 'chat_allowdelmes' => $chat_allowdelmes, 'chat_logmessage' => $chat_logmessage, 'chat_nickchange' => $chat_nickchange, 'chat_botname' => $chat_botname, 'chat_channelname' => $chat_channelname);
Config::update($config_after);
$CONF = Config::getAll(NULL, 1);
$LOG = new Log(3);
$LOG->target = 3;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$template = new template();
$template->assign_vars(array('chat_closed' => $CONF['chat_closed'], 'chat_allowchan' => $CONF['chat_allowchan'], 'chat_allowmes' => $CONF['chat_allowmes'], 'chat_logmessage' => $CONF['chat_logmessage'], 'chat_nickchange' => $CONF['chat_nickchange'], 'chat_botname' => $CONF['chat_botname'], 'chat_channelname' => $CONF['chat_channelname'], 'se_server_parameters' => $LNG['se_server_parameters'], 'se_save_parameters' => $LNG['se_save_parameters'], 'ch_closed' => $LNG['ch_closed'], 'ch_allowchan' => $LNG['ch_allowchan'], 'ch_allowmes' => $LNG['ch_allowmes'], 'ch_allowdelmes' => $LNG['ch_allowdelmes'], 'ch_logmessage' => $LNG['ch_logmessage'], 'ch_nickchange' => $LNG['ch_nickchange'], 'ch_botname' => $LNG['ch_botname'], 'ch_channelname' => $LNG['ch_channelname']));
$template->show('ChatConfigBody.tpl');
}
示例4: ShowDisclamerPage
function ShowDisclamerPage()
{
global $LNG, $USER;
$CONF = Config::getAll(NULL, $_SESSION['adminuni']);
if (!empty($_POST)) {
$config_before = array('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice']);
$disclamerAddress = HTTP::_GP('disclamerAddress', '', true);
$disclamerPhone = HTTP::_GP('disclamerPhone', '', true);
$disclamerMail = HTTP::_GP('disclamerMail', '', true);
$disclamerNotice = HTTP::_GP('disclamerNotice', '', true);
$config_after = array('disclamerAddress' => $disclamerAddress, 'disclamerPhone' => $disclamerPhone, 'disclamerMail' => $disclamerMail, 'disclamerNotice' => $disclamerNotice);
Config::update($config_after);
$CONF = Config::getAll(NULL, $_SESSION['adminuni']);
$LOG = new Log(3);
$LOG->target = 5;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$template = new template();
$template->loadscript('../base/jquery.autosize-min.js');
$template->execscript('$(\'textarea\').autosize();');
$template->assign_vars(array('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice'], 'se_server_parameters' => $LNG['mu_disclamer'], 'se_save_parameters' => $LNG['se_save_parameters'], 'se_disclamerAddress' => $LNG['se_disclamerAddress'], 'se_disclamerPhone' => $LNG['se_disclamerPhone'], 'se_disclamerMail' => $LNG['se_disclamerMail'], 'se_disclamerNotice' => $LNG['se_disclamerNotice']));
$template->show('DisclamerConfigBody.tpl');
}
示例5: ShowChatConfigPage
function ShowChatConfigPage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());
if (!empty($_POST)) {
$config_before = array('chat_closed' => $config->chat_closed, 'chat_allowchan' => $config->chat_allowchan, 'chat_allowmes' => $config->chat_allowmes, 'chat_allowdelmes' => $config->chat_allowdelmes, 'chat_logmessage' => $config->chat_logmessage, 'chat_nickchange' => $config->chat_nickchange, 'chat_botname' => $config->chat_botname, 'chat_channelname' => $config->chat_channelname);
$chat_allowchan = isset($_POST['chat_allowchan']) && $_POST['chat_allowchan'] == 'on' ? 1 : 0;
$chat_allowmes = isset($_POST['chat_allowmes']) && $_POST['chat_allowmes'] == 'on' ? 1 : 0;
$chat_allowdelmes = isset($_POST['chat_allowdelmes']) && $_POST['chat_allowdelmes'] == 'on' ? 1 : 0;
$chat_logmessage = isset($_POST['chat_logmessage']) && $_POST['chat_logmessage'] == 'on' ? 1 : 0;
$chat_nickchange = isset($_POST['chat_nickchange']) && $_POST['chat_nickchange'] == 'on' ? 1 : 0;
$chat_closed = isset($_POST['chat_closed']) && $_POST['chat_closed'] == 'on' ? 1 : 0;
$chat_channelname = HTTP::_GP('chat_channelname', '', true);
$chat_botname = HTTP::_GP('chat_botname', '', true);
$config_after = array('chat_closed' => $chat_closed, 'chat_allowchan' => $chat_allowchan, 'chat_allowmes' => $chat_allowmes, 'chat_allowdelmes' => $chat_allowdelmes, 'chat_logmessage' => $chat_logmessage, 'chat_nickchange' => $chat_nickchange, 'chat_botname' => $chat_botname, 'chat_channelname' => $chat_channelname);
foreach ($config_after as $key => $value) {
$config->{$key} = $value;
}
$config->save();
$LOG = new Log(3);
$LOG->target = 3;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$template = new template();
$template->assign_vars(array('chat_closed' => $config->chat_closed, 'chat_allowchan' => $config->chat_allowchan, 'chat_allowmes' => $config->chat_allowmes, 'chat_logmessage' => $config->chat_logmessage, 'chat_nickchange' => $config->chat_nickchange, 'chat_botname' => $config->chat_botname, 'chat_channelname' => $config->chat_channelname, 'se_server_parameters' => $LNG['se_server_parameters'], 'se_save_parameters' => $LNG['se_save_parameters'], 'ch_closed' => $LNG['ch_closed'], 'ch_allowchan' => $LNG['ch_allowchan'], 'ch_allowmes' => $LNG['ch_allowmes'], 'ch_allowdelmes' => $LNG['ch_allowdelmes'], 'ch_logmessage' => $LNG['ch_logmessage'], 'ch_nickchange' => $LNG['ch_nickchange'], 'ch_botname' => $LNG['ch_botname'], 'ch_channelname' => $LNG['ch_channelname']));
$template->show('ChatConfigBody.tpl');
}
示例6: logger
public function logger($message)
{
if ($this->config->get('bluepay_hosted_debug') == 1) {
$log = new Log('bluepay_hosted.log');
$log->write($message);
}
}
示例7: insert
public function insert($error)
{
$log = new Log();
$log->error = $error;
$log->type = $this->accType;
$log->save();
}
示例8: getMethod
public function getMethod($address, $total)
{
// Load dependencies
$this->load->library('bitcoin');
$this->load->language('payment/bitcoin');
// Connect to the server
$this->_bitcoin = new BitCoin($this->config->get('bitcoin_user'), $this->config->get('bitcoin_password'), $this->config->get('bitcoin_host'), $this->config->get('bitcoin_port'), $this->config->get('bitcoin_path'));
// Check for errors
if ($this->_bitcoin->error) {
// Save errors to the log
$log = new Log('bitcoin.log');
$log->write($this->_bitcoin->error);
// Block this payment gateway if connection failed
return false;
}
// Get active Geo-Zones
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $this->config->get('bitcoin_geo_zone_id') . "' AND country_id = '" . (int) $address['country_id'] . "' AND (zone_id = '" . (int) $address['zone_id'] . "' OR zone_id = '0')");
// Check for order total
if ($this->config->get('bitcoin_total') > 0 && $this->config->get('bitcoin_total') > $total) {
$status = false;
// Check for Geo-Zone
} elseif (!$this->config->get('bitcoin_geo_zone_id')) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
// Add BitCoin Payment Option to the Order Form
$method_data = array();
if ($status) {
$method_data = array('code' => 'bitcoin', 'title' => $this->language->get('text_title'), 'terms' => '', 'sort_order' => $this->config->get('bitcoin_sort_order'));
}
return $method_data;
}
示例9: testFirstLogMessageCreatesFileIfNonexistent
function testFirstLogMessageCreatesFileIfNonexistent()
{
@unlink(dirname(__FILE__) . 'temp/test.log');
$log = new Log(dirname(__FILE__) . 'temp/test.log');
$log->message('Should write to this file');
$this->assertTrue(file_exists(dirname(__FILE__) . 'temp/test.log'));
}
示例10: getLowestPaymentAccount
private function getLowestPaymentAccount($country)
{
switch ($country) {
case 'SWE':
$amount = 50.0;
break;
case 'NOR':
$amount = 95.0;
break;
case 'FIN':
$amount = 8.949999999999999;
break;
case 'DNK':
$amount = 89.0;
break;
case 'DEU':
case 'NLD':
$amount = 6.95;
break;
default:
$log = new Log('billmate_account.log');
$log->write('Unknown country ' . $country);
$amount = NULL;
break;
}
return $amount;
}
示例11: deleteExpiredData
/**
* clear expired cached files
* >> >php index.php "/cron/deleteExpiredCacheData"
* @param \Base $f3
*/
function deleteExpiredData(\Base $f3)
{
$time_start = microtime(true);
// cache dir (dir is recursively searched...)
$cacheDir = $f3->get('TEMP');
$filterTime = (int) strtotime('-' . $f3->get('PATHFINDER.CACHE.EXPIRE_MAX') . ' seconds');
$expiredFiles = Search::getFilesByMTime($cacheDir, $filterTime);
$deletedFiles = 0;
$deletedSize = 0;
$notWritableFiles = 0;
$deleteErrors = 0;
foreach ($expiredFiles as $filename => $file) {
/**
* @var $file \SplFileInfo
*/
if ($file->isWritable()) {
$tmpSize = $file->getSize();
if (unlink($file->getRealPath())) {
$deletedSize += $tmpSize;
$deletedFiles++;
} else {
$deleteErrors++;
}
} else {
$notWritableFiles++;
}
}
$execTime = microtime(true) - $time_start;
// Log ------------------------
$log = new \Log('cron_' . __FUNCTION__ . '.log');
$log->write(sprintf(self::LOG_TEXT, __FUNCTION__, $deletedFiles, $deletedSize, $notWritableFiles, $deleteErrors, $execTime));
}
示例12: ShowTeamspeakPage
function ShowTeamspeakPage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());
if ($_POST) {
$config_before = array('ts_timeout' => $config->ts_timeout, 'ts_modon' => $config->ts_modon, 'ts_server' => $config->ts_server, 'ts_tcpport' => $config->ts_tcpport, 'ts_udpport' => $config->ts_udpport, 'ts_version' => $config->ts_version, 'ts_login' => $config->ts_login, 'ts_password' => $config->ts_password, 'ts_cron_interval' => $config->ts_cron_interval);
$ts_modon = isset($_POST['ts_on']) && $_POST['ts_on'] == 'on' ? 1 : 0;
$ts_server = HTTP::_GP('ts_ip', '');
$ts_tcpport = HTTP::_GP('ts_tcp', 0);
$ts_udpport = HTTP::_GP('ts_udp', 0);
$ts_timeout = HTTP::_GP('ts_to', 0);
$ts_version = HTTP::_GP('ts_v', 0);
$ts_login = HTTP::_GP('ts_login', '');
$ts_password = HTTP::_GP('ts_password', '', true);
$ts_cron_interval = HTTP::_GP('ts_cron', 0);
$config_after = array('ts_timeout' => $ts_timeout, 'ts_modon' => $ts_modon, 'ts_server' => $ts_server, 'ts_tcpport' => $ts_tcpport, 'ts_udpport' => $ts_udpport, 'ts_version' => $ts_version, 'ts_login' => $ts_login, 'ts_password' => $ts_password, 'ts_cron_interval' => $ts_cron_interval);
foreach ($config_after as $key => $value) {
$config->{$key} = $value;
}
$config->save();
$sql = "UPDATE %%CRONJOBS%%\n\t\tSET isActive = :isActive, `lock` = NULL, nextTime = 0\n\t\tWHERE name = 'teamspeak';";
Database::get()->update($sql, array(':isActive' => $ts_modon));
$LOG = new Log(3);
$LOG->target = 4;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$template = new template();
$template->assign_vars(array('se_save_parameters' => $LNG['se_save_parameters'], 'ts_tcpport' => $LNG['ts_tcpport'], 'ts_serverip' => $LNG['ts_serverip'], 'ts_version' => $LNG['ts_version'], 'ts_active' => $LNG['ts_active'], 'ts_settings' => $LNG['ts_settings'], 'ts_udpport' => $LNG['ts_udpport'], 'ts_timeout' => $LNG['ts_timeout'], 'ts_server_query' => $LNG['ts_server_query'], 'ts_sq_login' => $LNG['ts_login'], 'ts_sq_pass' => $LNG['ts_pass'], 'ts_lng_cron' => $LNG['ts_cron'], 'ts_to' => $config->ts_timeout, 'ts_on' => $config->ts_modon, 'ts_ip' => $config->ts_server, 'ts_tcp' => $config->ts_tcpport, 'ts_udp' => $config->ts_udpport, 'ts_v' => $config->ts_version, 'ts_login' => $config->ts_login, 'ts_password' => $config->ts_password, 'ts_cron' => $config->ts_cron_interval));
$template->show('TeamspeakPage.tpl');
}
示例13: error
function error($f3)
{
$log = new Log('error.log');
$log->write($f3->get('ERROR.text'));
foreach ($f3->get('ERROR.trace') as $frame) {
if (isset($frame['file'])) {
// Parse each backtrace stack frame
$line = '';
$addr = $f3->fixslashes($frame['file']) . ':' . $frame['line'];
if (isset($frame['class'])) {
$line .= $frame['class'] . $frame['type'];
}
if (isset($frame['function'])) {
$line .= $frame['function'];
if (!preg_match('/{.+}/', $frame['function'])) {
$line .= '(';
if (isset($frame['args']) && $frame['args']) {
$line .= $f3->csv($frame['args']);
}
$line .= ')';
}
}
// Write to custom log
$log->write($addr . ' ' . $line);
}
}
Template::instance()->render('error.html');
}
示例14: create
/**
* @param \String $image
* @return resource
* @throws Exception
*/
private function create($image)
{
$mime = $this->info['mime'];
$image = trim($image);
try {
if (!file_exists($image)) {
throw new InvalidArgumentException("Image file '{$image}' doesn't exist");
}
if ($mime == 'image/gif') {
$image = imagecreatefromgif($image);
} elseif ($mime == 'image/png') {
$image = @imagecreatefrompng($image);
} elseif ($mime == 'image/jpeg') {
$image = imagecreatefromjpeg($image);
}
return $image;
} catch (Exception $exc) {
$logger = new Log('error.log');
$tmpExc = $exc;
while ($tmpExc != null) {
$logger->write($exc->getMessage());
$tmpExc = $tmpExc->getPrevious();
}
throw $exc;
}
}
示例15: error_handler
/**
* Error handler, called when an error occurs
*
* @param int $errno Error code
* @param int $errstr Error message
* @param int $errfile File in which the error occured
* @param int $errline Line of the file where the error occured
*/
function error_handler($errno, $errstr, $errfile, $errline)
{
$log = new Log('php_errors.log');
$msg = '';
$exception = true;
// cf. http://www.php.net/manual/en/function.set-error-handler.php
switch ($errno) {
case E_ERROR:
case E_USER_ERROR:
$msg = 'Fatal error: ' . $errstr . ' in ' . $errfile . ':' . $errline;
$log->write($msg);
if (Config::DEBUG) {
return $msg;
} else {
return 'An error occured, please try again later.';
}
break;
case E_WARNING:
case E_USER_WARNING:
$msg = 'Warning: ' . $errstr . ' in ' . $errfile . ':' . $errline;
break;
case E_NOTICE:
case E_USER_NOTICE:
$msg = 'Notice: ' . $errstr . ' in ' . $errfile . ':' . $errline;
$exception = false;
break;
default:
$msg = 'Unknown error [' . $errno . ']: ' . $errstr . ' in ' . $errfile . ':' . $errline;
break;
}
$log->write($msg);
if ($exception) {
throw new Exception($msg, $errno);
}
}