本文整理汇总了PHP中Logger::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::write方法的具体用法?PHP Logger::write怎么用?PHP Logger::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init()
{
if (isset($_COOKIE["PHPSESSID"]) && !empty($_COOKIE["PHPSESSID"])) {
if (file_exists("../helpers/_getUserInfo.php")) {
include_once "../helpers/_getUserInfo.php";
User_get::info();
}
}
$exception = new Exception();
switch (_MODE_) {
case "local":
ob_start();
ini_set('display_errors', 1);
error_reporting(E_ALL);
break;
case "production":
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
ob_start(null, 0, PHP_OUTPUT_HANDLER_STDFLAGS ^ PHP_OUTPUT_HANDLER_REMOVABLE);
} else {
ob_start(null, 0, false);
Logger::write("index.php; #8; ошибка ob_start PHP < 5.4");
}
ini_set("memory_limit", "256M");
break;
}
}
示例2: testWrite
public function testWrite()
{
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->setMethods(array('emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug', 'log'))->getMock();
$logger->expects($this->once())->method('info')->with($this->identicalTo('foobar'));
$output = new Logger($logger);
$output->write('foobar');
}
示例3: fn_logs
/**
* Display the log file contents for today
*
* @param string $q
* @param array $matches
* @param array $params
*/
function fn_logs($q, $matches, $params)
{
$log_file = TITANIUM_ROOT . 'logs/' . date('Y-m-d') . '.txt';
Logger::write("Reading log file: {$log_file}");
if (file_exists($log_file)) {
Output::write(file_get_contents($log_file), false, true);
} else {
Output::write("{$log_file} does not exist.", 'red', true);
}
}
示例4: __construct
public function __construct($number, $message)
{
$this->result['data']['error'] = true;
$this->result['data']['pageName'] = 'Error ' . $number;
$this->result['data']['errorMessage'] = $message;
$this->result['data']['style'] = 'error';
$this->result['view']['content'] = 'viewError.tpl';
//Логируем ошибку
Logger::write($message);
}
示例5: exceptionHandler
/**
*
* classic exeption Handler
*
* @param unknown_type $e
*/
public static function exceptionHandler($e)
{
Logger::write('error', $e->getMessage() . PHP_EOL . $e->getFile() . PHP_EOL . $e->getLine());
if (Configuration::getInstance()->get('config.showErrors')) {
echo '<h1>' . get_class($e) . '</h1>';
echo implode(PHP_EOL, array($e->getMessage(), $e->getFile(), $e->getLine()));
var_dump($e);
exit;
}
return self::_renderErrorPage($e);
}
示例6: renderTemplate
protected function renderTemplate($name)
{
try {
$module = $this->_request->getModuleName();
$this->_view->setScriptPath(APPLICATION_PATH . 'modules/' . $module . '/views/');
return $this->_view->render('templates/' . $name . '.tpl');
} catch (Exception $e) {
Logger::write($e->__toString(), Zend_Log::ERR);
return false;
}
return true;
}
示例7: load
static function load($name_module)
{
$modules_data = self::init_modules();
foreach ($modules_data as $key => $value) {
if ($key == $name_module) {
if (include_once $value) {
} else {
Logger::write("modules.php; #42; ошибка подключения модуля {$key} по пути {$value}");
}
}
}
}
示例8: __construct
public function __construct()
{
if (file_exists("actions/products_action.php")) {
require_once "actions/products_action.php";
} else {
Logger::write("Ошибка подключения /actions/products_action.php в ../core/controllers/products_controller.php");
}
if (file_exists("view/products.php")) {
require_once "view/products.php";
} else {
Logger::write("Ошибка подключения /view/products.php в ../core/controllers/products_controller.php");
}
}
示例9: __construct
/**
* Connects to database object and select database to use
*
* @return void
*/
public function __construct()
{
//Establish connection with the databae
$host = $this->host;
$dbname = $this->database;
try {
$this->DBH = new PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $this->username, $this->password);
$this->DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->DBH->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
} catch (PDOExeception $ex) {
$error = $ex->getMessage();
Logger::write("PDO", $error);
}
}
示例10: regenerate_id
function regenerate_id()
{
$old_sess_id = session_id();
session_regenerate_id(true);
$new_sess_id = session_id();
Logger::write($old_sess_id . '-' . $new_sess_id, 'session.log');
$time = time();
if (!isset($this->u_stmt)) {
$this->u_stmt = $this->db->prepare(" UPDATE " . $this->table_name . " set id = ? where id=?");
}
$this->u_stmt->bind_param('ss', $new_sess_id, $old_sess_id);
$this->u_stmt->execute();
return true;
}
示例11: connect
/**
* 连接数据库
*/
public function connect()
{
try {
if (isEmptyString($this->config['username']) || isEmptyString($this->config['password'])) {
$this->connection = new MongoClient(sprintf('mongodb://%s:%d', $this->config['host'], $this->config['port']));
} else {
$this->connection = new MongoClient(sprintf('mongodb://%s:%d', $this->config['host'], $this->config['port']), array('username' => $this->config['username'], 'password' => $this->config['password'], 'db' => $this->config['db']));
}
$this->connection->setReadPreference(MongoClient::RP_SECONDARY_PREFERRED, array());
} catch (Exception $e) {
$this->collection = null;
$this->connection = null;
Logger::write($e->__toString(), ERR);
}
}
示例12: popularBox
public static function popularBox()
{
if (file_exists("actions/popularbox_action.php")) {
include_once "actions/popularbox_action.php";
$popularlist = Popularbox::popularList();
$cnt = count($popularlist);
for ($i = 0; $i <= $cnt; $i++) {
if (!empty($popularlist[$i]['id'])) {
include "view/popular.php";
}
}
} else {
Logger::write("main controller.php : отстутствует actions/popularbox_action.php");
}
}
示例13: autoload
/**
*
* resolve class name to filename
* @param $class
*/
public function autoload($class)
{
$file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
foreach ($this->_includePaths as $path) {
$filename = $path . DIRECTORY_SEPARATOR . $file;
if (is_readable($filename)) {
include $filename;
break;
}
}
if (!class_exists($class)) {
Logger::write('error', $class);
trigger_error('Class ' . $class . ' not found');
}
return;
}
示例14: generic
protected static function generic($data, $title, $keyw, $desc)
{
$data = strtolower($data);
$file_gen_controller = "../core/controllers/" . $data . "_controller.php";
$file_gen_view = "../core/view/" . $data . ".php";
$file_gen_action = "../core/actions/" . $data . "_action.php";
$write_controller = '<?php
class ' . $data . ' {
public function __construct() {
if(file_exists("actions/' . $data . '_action.php"))
require_once "actions/' . $data . '_action.php";
else
Logger::write("Ошибка подключения /actions/' . $data . '_action.php в ../core/controllers/' . $data . '_controller.php");
if(file_exists("view/' . $data . '.php"))
require_once "view/' . $data . '.php";
else
Logger::write("Ошибка подключения /view/' . $data . '.php в ../core/controllers/' . $data . '_controller.php");
}
}
?>';
$write_view = '<?php echo "страница ' . $data . '" ?>';
$write_action = '<?php
class ' . $data . '_action {
public function __construct() {
}
}
?>';
$cntr = fopen($file_gen_controller, "a");
$controllerres = fwrite($cntr, $write_controller);
fclose($cntr);
$vw = fopen($file_gen_view, "a");
$view_res = fwrite($vw, $write_view);
fclose($vw);
$act = fopen($file_gen_action, "a");
$action_res = fwrite($act, $write_action);
fclose($act);
if ($controllerres && $view_res && $action_res) {
include_once $_SERVER['DOCUMENT_ROOT'] . "/controls/actions/categories_action.php";
Categories_action::writeGenCat($data, $title, $keyw, $desc);
} else {
Logger::write("_generator.php не удалось сгенерировать один из фвйлов");
}
}
示例15: autoload
static function autoload()
{
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/helpers/logger.php")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/helpers/logger.php";
} else {
echo "autoloader ERROR! cannot file of the system";
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/config/config.php")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/config/config.php";
} else {
Logger::write("ошибка require_once /config/config.php в autoloader.php ");
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/config/remote.db.php")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/config/remote.db.php";
} else {
Logger::write("ошибка require_once /config/remote.db.php в autoloader.php ");
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/config/init.php")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/config/init.php";
} else {
echo "autoloader ERROR! cannot file of the system";
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/helpers/modules.php")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/helpers/modules.php";
} else {
Logger::write("ошибка require_once /helpers/modules.php в autoloader.php ");
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/helpers/clear_code.php")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/helpers/clear_code.php";
} else {
Logger::write("ошибка require_once /helpers/clear_code.php в autoloader.php ");
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/helpers/db.operations.php")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/helpers/db.operations.php";
} else {
Logger::write("ошибка require_once /helpers/db.operations.php в autoloader.php ");
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/helpers/_generator.php")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/helpers/_generator.php";
} else {
Logger::write("ошибка require_once /helpers/_generator.php в autoloader.php");
}
}