本文整理汇总了PHP中Log::Write方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::Write方法的具体用法?PHP Log::Write怎么用?PHP Log::Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$data = $this->_context->get("data", '');
// Log::Write('【加密数据】Remote Accept:' . $data, Log::DEBUG);
if ($this->_context->isPOST()) {
$de_data = Crypt::decrypt($data, App::getConfig('YUC_SECURE_KEY'));
// Log::Write('解析的加密数据:' . $de_data, Log::DEBUG);
$post = json_decode($de_data, TRUE);
if ($post != '' && is_array($post) && $post['site_key'] == md5(App::getConfig('YUC_SITE_KEY'))) {
$mod = $post['mod'];
$act = $post['act'];
$class = 'Remote_' . $mod;
if ($act == 'show' && $mod == 'Logs') {
$name = $post['name'];
$obj = new $class();
//self::$_string[' $name']=$name;
$ret = $obj->{$act}($name);
} else {
$obj = new $class();
$ret = $obj->{$act}();
}
Log::Write('Remote Run:' . $mod . ',' . $act . ',' . $ret, Log::DEBUG);
_returnCryptAjax($ret);
} else {
Log::Write('安全认证错误!', Log::DEBUG);
_returnCryptAjax(array('result' => 0, 'content' => '安全认证比对错误错误!'));
}
} else {
Log::Write('远程控制错误!数据并非POST交互!', Log::DEBUG);
_returnCryptAjax(array('result' => 0, 'content' => '远程控制错误!数据并非POST交互!'));
}
}
示例2: __toString
/**
* 异常输出 所有异常处理类均通过__toString方法输出错误
* 每次异常都会写入系统日志
* 该方法可以被子类重载
* @access public
* @return array
*/
public function __toString()
{
$trace = $this->getTrace();
//throw_exception抛出异常不显示多余信息
// if($this->extra)
// array_shift($trace);
// p($trace);
$this->class = isset($trace[0]['class']) ? $trace[0]['class'] : '';
$this->function = isset($trace[0]['function']) ? $trace[0]['function'] : '';
$this->file = isset($trace[0]['file']) ? $trace[0]['file'] : '';
$this->line = isset($trace[0]['line']) ? $trace[0]['line'] : '';
$traceInfo = '';
$time = date('y-m-d H:i:m');
foreach ($trace as $t) {
if (isset($t['file'])) {
$traceInfo .= '[' . $time . '] ' . $t['file'] . ' (' . $t['line'] . ') ';
if (isset($t['class'])) {
$traceInfo .= $t['class'] . $t['type'] . $t['function'];
}
$traceInfo .= "\n";
}
}
$error['message'] = $this->message;
$error['type'] = $this->type;
$error['class'] = $this->class;
$error['function'] = $this->function;
$error['file'] = $this->file;
$error['line'] = $this->line;
$error['trace'] = $traceInfo;
// 记录 Exception 日志
if (C('LOG_EXCEPTION_RECORD')) {
Log::Write('(' . $this->type . ') ' . $this->message);
}
return $error;
}
示例3: run
/**
* 执行Action
*/
public static function run($class)
{
$instance = new $class();
$instance->run();
Log::Write('System Run Class<run>:' . $class, Log::DEBUG);
ob_get_flush();
return $instance;
}
示例4: update
public function update()
{
Log::Write(serialize($_POST));
$result = posi_update(json_decode($_POST['posi'], true));
if ($result) {
return array('result' => 1, 'content' => '');
} else {
return array('result' => 0, 'content' => '无权限写入数据本地配置文件');
}
}
示例5: show
public function show($name = '')
{
// $name=self::$_string[' $name'];
$ret = array();
//$name = isset($_POST['name']) ? $_POST['name'] : '';
//$name ='20120831.log';
$file = M_PRO_DIR . '/Runtime/Log/' . $name . '.php';
Log::Write('file:' . $file, Log::DEBUG);
$ret = file_get_contents($file);
return array('result' => 1, 'content' => $ret);
}
示例6: __construct
public function __construct()
{
/*
mysql_connect('127.0.0.1','fukuro', '12');
mysql_select_db('test');*/
try {
$this->dbh = new PDO('mysql:dbname=test; host=127.0.0.1', 'fukuro', '12');
} catch (PDOException $e) {
$log = new Log();
$log->Write('test.txt', $e);
$log->Read('test.txt');
header('Refresh: 1; url=./views/403.php');
die("Sorry.Couldn't connect with database!");
}
}
示例7: sendVerifyLocalRequest
/**
* 本地验证
* @param type $ssid
* @param type $result
* @return type
*/
public static function sendVerifyLocalRequest($ssid, $result)
{
$mass = Context::getInstance()->get('yuc_mass', '');
$code = Crypt::decrypt(urldecode($mass), Math::erypt_key());
$code = str_replace(",", "", $code);
if ($code != '' && strtolower($code) === strtolower($result)) {
self::$_yuc_result = 1;
self::$_yuc_code = '';
self::$_yuc_details = '验证码输入正确';
} else {
self::$_yuc_result = 0;
self::$_yuc_code = 'E_LOCALVALID_001';
self::$_yuc_details = '验证码验证失败';
}
Log::Write('本地验证完成,输入结果为:' . $result . ';' . '', Log::DEBUG);
return array('code' => self::$_yuc_code, 'result' => self::$_yuc_result, 'details' => self::$_yuc_details);
}
示例8: __toString
/**
* 异常输出 所有异常处理类均通过__toString方法输出错误
* 每次异常都会写入系统日志
* 该方法可以被子类重载
* @access public
* @return array
*/
public function __toString()
{
$trace = $this->getTrace();
if ($this->extra) {
// 通过throw_exception抛出的异常要去掉多余的调试信息
array_shift($trace);
}
$this->class = isset($trace[0]['class']) ? $trace[0]['class'] : '';
$this->function = isset($trace[0]['function']) ? $trace[0]['function'] : '';
$this->file = $trace[0]['file'];
$this->line = $trace[0]['line'];
$file = file($this->file);
$traceInfo = '';
$time = date('y-m-d H:i:m');
foreach ($trace as $t) {
// $traceInfo .= '['.$time.'] '.$t['file'].' ('.$t['line'].') ';
// $traceInfo .= $t['class'].$t['type'].$t['function'].'(';
// $traceInfo .= implode(', ', $t['args']);
// $traceInfo .=")\n";
print_r($t);
}
$error['message'] = $this->message;
$error['type'] = $this->type;
$error['detail'] = L('_MODULE_') . '[' . MODULE_NAME . '] ' . L('_ACTION_') . '[' . ACTION_NAME . ']' . "\n";
$error['detail'] .= $this->line - 2 . ': ' . $file[$this->line - 3];
$error['detail'] .= $this->line - 1 . ': ' . $file[$this->line - 2];
$error['detail'] .= '<font color="#FF6600" >' . $this->line . ': <strong>' . $file[$this->line - 1] . '</strong></font>';
$error['detail'] .= $this->line + 1 . ': ' . $file[$this->line];
$error['detail'] .= $this->line + 2 . ': ' . $file[$this->line + 1];
$error['class'] = $this->class;
$error['function'] = $this->function;
$error['file'] = $this->file;
$error['line'] = $this->line;
$error['trace'] = $traceInfo;
// 记录 Exception 日志
if (C('LOG_EXCEPTION_RECORD')) {
Log::Write('(' . $this->type . ') ' . $this->message);
}
return $error;
}
示例9: comError
/**
* 错误处理
* @param $code
* @param $message
* @param $file
* @param $line
* @internal param $ <type> $e
*/
public static function comError($code, $message, $file, $line)
{
$errors['Message'] = $message;
$errors['Code'] = $code;
$errors['Line'] = $line;
$errors['File'] = $file;
foreach ($errors as $key => $value) {
Log::Write("Error:{$key}:{$value}", Log::EMERG);
}
}
示例10: __destruct
/**
* 析构函数
*/
public function __destruct()
{
Log::Write('System Run Time >>>>:' . (microtime(TRUE) - M_START_TIME), Log::DEBUG);
}
示例11: isset
*/
/**
* Regular expressions
*$str = 'Hello, world! You are fine!';
*preg_match_all('/hello,[\s]/i',$str, $m);//Табуляция в конце
*preg_match_all('/^hello/i',$str, $m);//Якорь начала
*preg_match_all('/hello$/i',$str, $m);//Якорь конца
*preg_match_all('/fine[.,!]$/i', $str, $m);
*preg_match_all('/word|world/i', $str, $m);
*preg_match_all('/worl?d/i', $str, $m);
*preg_match_all('/worl+d/i', $str, $m);
*preg_match_all('/\w, \w/i', $str, $m); // "o, w"
*preg_match_all('/\w+, \w+/i', $str, $m);//"Hello, world"
var_dump($m);
*/
require_once __DIR__ . '/autoload.php';
$ctrl = isset($_GET['ctrl']) ? $_GET['ctrl'] : 'News';
$act = isset($_GET['act']) ? $_GET['act'] : 'All';
try {
$controllerClassName = $ctrl . 'Controller';
$controller = new $controllerClassName();
$method = 'action' . $act;
$controller->{$method}();
} catch (E404Exception $e) {
$view = new View();
$view->error = $e->getMessage();
$view->display('404.php');
$log = new Log();
$log->Write('test.txt', $e);
$log->Read('test.txt');
}
示例12: Log
<?php
require_once 'Log.class.php';
$log = new Log();
$log->Write('test.txt', 'My name is Kami');
echo $log->read('test.txt');
// output: 'My name is Kami in test.txt
示例13: Debug
public static function Debug($data)
{
Log::Write(5, "Debug", $data);
}
示例14: MessageSend
if (strlen($stream_about) > 400) {
MessageSend(1, 'Описание должно быть не более 400 символов!');
}
$db = new DB();
$db->connect();
$Row = $db->fetch_assoc($db->execute("SELECT `id` FROM `streams` WHERE `id` = '{$streamID}'"));
if (empty($Row['id'])) {
$db->close();
MessageSend(1, 'Стрим не найден!');
}
$db->execute("UPDATE `streams` SET `title` = '{$stream_title}', `about` = '{$stream_about}' WHERE `id` = '{$streamID}'");
if (isset($_REQUEST['stream-blocked'])) {
$db->execute("UPDATE `streams` SET `status` = '5' WHERE `id` = '{$streamID}'");
}
$db->close();
Log::Write(UserGroup($player['group']) . " " . $player['login'] . ", изменил стрим #" . $Row['streamID']);
MessageSend(3, 'Изменения сохранены!');
} elseif (isset($_GET['stream_id'])) {
$stream_id = (int) $_GET['stream_id'];
if (empty($stream_id)) {
MessageSend(1, 'Стрим не найден!');
}
$db = new DB();
$db->connect();
$Row = $db->fetch_assoc($db->execute("SELECT * FROM `streams` WHERE `id` = '{$stream_id}'"));
$db->close();
if (empty($Row['id'])) {
MessageSend(1, 'Стрим не найден!');
}
ob_start();
include SITE_ROOT . 'style/admin/streams/edit.html';
示例15: __toString
public function __toString()
{
$trace = $this->getTrace();
if ($this->extra) {
array_shift($trace);
}
$this->class = $trace[0]['class'];
$this->function = $trace[0]['function'];
$this->file = $trace[0]['file'];
$this->line = $trace[0]['line'];
$file = file($this->file);
$traceInfo = '';
$time = date("y-m-d H:i:m");
foreach ($trace as $t) {
$traceInfo .= '[' . $time . '] ' . $t['file'] . ' (' . $t['line'] . ') ';
$traceInfo .= $t['class'] . $t['type'] . $t['function'] . '(';
$traceInfo .= implode(', ', $t['args']);
$traceInfo .= ")\n";
}
$error['message'] = $this->message;
$error['type'] = $this->type;
$error['detail'] = L('_MODULE_') . '[' . MODULE_NAME . '] ' . L('_ACTION_') . '[' . ACTION_NAME . ']' . "\n";
$error['detail'] .= $this->line - 2 . ': ' . $file[$this->line - 3];
$error['detail'] .= $this->line - 1 . ': ' . $file[$this->line - 2];
$error['detail'] .= '<font color="#FF6600" >' . $this->line . ': <b>' . $file[$this->line - 1] . '</b></font>';
$error['detail'] .= $this->line + 1 . ': ' . $file[$this->line];
$error['detail'] .= $this->line + 2 . ': ' . $file[$this->line + 1];
$error['class'] = $this->class;
$error['function'] = $this->function;
$error['file'] = $this->file;
$error['line'] = $this->line;
$error['trace'] = $traceInfo;
Log::Write('(' . $this->type . ') ' . $this->message);
return $error;
}