本文整理汇总了PHP中log类的典型用法代码示例。如果您正苦于以下问题:PHP log类的具体用法?PHP log怎么用?PHP log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了log类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _send_reset
private function _send_reset($form)
{
$user_name = $form->reset->inputs["name"]->value;
$user = user::lookup_by_name($user_name);
if ($user && !empty($user->email)) {
$user->hash = random::hash();
$user->save();
$message = new View("reset_password.html");
$message->confirm_url = url::abs_site("password/do_reset?key={$user->hash}");
$message->user = $user;
Sendmail::factory()->to($user->email)->subject(t("Password Reset Request"))->header("Mime-Version", "1.0")->header("Content-type", "text/html; charset=UTF-8")->message($message->render())->send();
log::success("user", t("Password reset email sent for user %name", array("name" => $user->name)));
} else {
if (!$user) {
// Don't include the username here until you're sure that it's XSS safe
log::warning("user", t("Password reset email requested for user %user_name, which does not exist.", array("user_name" => $user_name)));
} else {
log::warning("user", t("Password reset failed for %user_name (has no email address on record).", array("user_name" => $user->name)));
}
}
// Always pretend that an email has been sent to avoid leaking
// information on what user names are actually real.
message::success(t("Password reset email sent"));
json::reply(array("result" => "success"));
}
开发者ID:HarriLu,项目名称:gallery3,代码行数:25,代码来源:password.php
示例2: cron
/**
* Берет список записей и генерирует документы
*/
public function cron()
{
$queue = $this->getList();
require_once ABS_PATH . '/classes/log.php';
$log = new log('docgen_cron/' . SERVER . '-%d%m%Y.log', 'a', "%d.%m.%Y %H:%M:%S: ");
foreach ($queue as $item) {
try {
$docGenClass = $this->getClass($item['class_name'], $item['class_params']);
$docGenClass->setData(mb_unserialize($item['fields']));
$docGenClass->setDocName($item['type'], $item['original_name']);
$docGenClass->beforeGenerate();
if ($docGenClass->isExcel($item['type'])) {
$ok = $docGenClass->generateExcel($item['type']);
} else {
$ok = $docGenClass->generate($item['type']);
}
if ($ok) {
$this->removeItem($item['id']);
} else {
$this->incrementTry($item['id']);
}
} catch (Exception $e) {
$log->writeln(sprintf("id = %s: %s", $item['id'], iconv('CP1251', 'UTF-8', $e->getMessage())));
$this->incrementTry($item['id']);
}
}
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:30,代码来源:DocGenQueue.php
示例3: postNextTopStory
function postNextTopStory()
{
// only post one story every three hours
$tstamp = $this->statusObj->getState('lastTwitterPost');
if (!isset($_GET['test']) and time() - $tstamp < 60 * TWITTER_INTERVAL_MINUTES) {
return;
}
//echo 'continuing';
require_once PATH_CORE . '/classes/content.class.php';
$cObj = new content($this->db);
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
$topStories = $cObj->fetchUpcomingStories();
$uid = 1;
while ($data = $this->db->readQ($topStories)) {
if (!$this->checkLog($uid, $data->siteContentId) and $data->score >= TWITTER_SCORE_THRESHOLD) {
// post to twitter
$result = $this->update($data->siteContentId, $data->title);
if ($result) {
$logItem = $logObj->serialize(0, $uid, 'postTwitter', $data->siteContentId);
$logObj->add($logItem);
$this->statusObj->setState('lastTwitterPost', time());
}
// only do one at a time
return;
}
}
}
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:28,代码来源:twitter.class.php
示例4: actionLog
public function actionLog()
{
$view = new ViewConstuctor();
$log = new \log();
$view->log = $log->getMessage();
$view->Display('Admin/Log');
}
开发者ID:AndreyLM,项目名称:home2,代码行数:7,代码来源:Admin.php
示例5: saveLog
public function saveLog($xml)
{
// !!!
// @todo Вот не знаю стоит ли тут делать так, или все же легче вызвать self::initReqXml(); но там у нас сессия инициализируется
$this->_clientXml = new DOMDocument();
libxml_use_internal_errors(true);
if (!$this->_clientXml->loadXML($xml)) {
$this->_debug = 1;
$xe_levels = array(LIBXML_ERR_WARNING => 'WARNING', LIBXML_ERR_ERROR => 'ERROR', LIBXML_ERR_FATAL => 'FATAL');
foreach (libxml_get_errors() as $xe) {
$err .= $xe_levels[$xe->level] . ": (line: {$xe->line}, column: {$xe->column}): {$xe->message}";
}
libxml_clear_errors();
$this->error(EXTERNAL_ERR_WRONG_REQ, $err);
}
$ns_name = basename($this->_clientXml->documentElement->getAttribute('xmlns:f'));
if ($ns_name == '') {
$ns_name = basename($this->_clientXml->documentElement->getAttribute('xmlns:hh'));
} else {
$ns_name = 'freetray';
}
if ($ns_name == '') {
$ns_name = 'other';
}
$log = new log("external/{$ns_name}-%d%m%Y.log");
$log->writeln('--------------' . getRemoteIP() . '--------------');
$log->writeln($xml);
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:28,代码来源:server.php
示例6: update
/**
* 通过id获取信息
*/
public function update($_POST)
{
$log = new log();
$log->addLog("update test", 1);
$columns[0] = "field1";
$values[0] = $_POST['field1'];
$columns[1] = "field2";
$values[1] = $_POST['field2'];
$row = $this->db->updateParamById("test", $columns, $values, "id", $_POST['id']);
return $row;
}
开发者ID:huangzhichao,项目名称:php_dwz,代码行数:14,代码来源:class.test.php
示例7: GetOne
public function GetOne($id)
{
$query = 'SELECT * FROM ' . $this->tableName . ' WHERE id=:id';
$param[':id'] = $id;
$res = $this->query($query, $param);
if (empty($res)) {
$log = new log();
$log->write('Trying to get unexisting article');
throw new E404Exception('The article with id=' . $id . ' was not found');
}
return $this->query($query, $param)[0];
}
开发者ID:AndreyLM,项目名称:home2,代码行数:12,代码来源:db.php
示例8: payment
public function payment($sum)
{
// На бете альфе включаем дебаг режим
if (!is_release()) {
//$sum = 0.1;// @debug
$this->api->setDebug(true);
}
$result = $this->api->requestPayment(round((double) $sum, 2), $this->account->id);
if ($result['status'] == API_Webmoney::STATUS_SUCCESS) {
$process = $this->api->processPayment($this->api->merchant_transaction_id, $result['processor_transaction_id']);
switch ($process['status']) {
case API_Webmoney::STATUS_PAYMENT_PROGRESS:
case API_Webmoney::STATUS_PAYMENT_SUCCESS:
// Зачисляем деньги на бете/альфе
// if(!is_release()) {
// $paymentDateTime = date('d.m.Y H:i');
// $orderNumber = rand(1, 99999999);
// $descr = "WebMoney с кошелька {$this->data['wallet']} сумма - {$sum}, обработан {$paymentDateTime}, номер покупки - $orderNumber";
//
// $this->account->deposit($op_id, $this->account->id, $sum, $descr, 3, $sum, 12);
// }
return true;
break;
case API_Webmoney::STATUS_PAYMENT_FAIL:
ob_start();
var_dump($result);
var_dump($process);
$content = ob_get_clean();
$this->log->writeln("FAIL Payment:\naccount:{$this->account->id}\n");
$this->log->write("Request:\n " . $this->api->last_request->getBody());
$this->log->write("Result:\n {$content}");
return false;
break;
// Отложить платеж на пол часа
// @todo придумать как отложить запрос на потом
//case API_Webmoney::STATUS_PAYMENT_PROCESS:
// Отложить платеж на пол часа
// @todo придумать как отложить запрос на потом
//case API_Webmoney::STATUS_PAYMENT_PROCESS:
default:
return;
break;
}
} else {
ob_start();
var_dump($result);
$content = ob_get_clean();
$this->log->writeln("FAIL Payment:\naccount:{$this->account->id}\n");
$this->log->write("Request:\n " . $this->api->last_request->getBody());
$this->log->write("Result:\n {$content}");
return false;
}
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:53,代码来源:walletWebmoney.php
示例9: registerPartido
/**
* Esta funcion guarda en el log para el sistema de auditoria
* @access public
* @author: fzalazar
* @param $accion: id de la accion
* @param $parametro: descripcion de la accion (opcional)
* @param $torneo: id del torneo (opcional)
* @param $rueda: rueda (opcional)
* @param $fecha: numero de fecha (opcional)
* @param $partido: partido (opcional)
* @return true si pudo insertar en el log, false en caso contrario
* @modificacion: dabiricha (agregado de parametros opcionales: torneo, rueda, fecha y partido)
*/
function registerPartido($accion, $parametro = '', $torneo = 0, $rueda = 0, $fecha = 0, $partido = 0)
{
$log = new log();
$log->id_accion = $accion;
$log->fecha = date("Y/m/d");
$log->hora = date("H:i:s");
$log->parametro = $parametro ? $parametro : NULL;
$log->torneo = $torneo;
$log->rueda = $rueda;
$log->numero_fecha = $fecha;
$log->partido = $partido;
$log->id_usuario = RegistryHelper::getIdUsuario();
return $log->insert();
}
开发者ID:Nilphy,项目名称:moteguardian,代码行数:27,代码来源:clase.Logger.php
示例10: start
static function start()
{
self::boot();
// 函数库
require CORE_PATH . 'load.php';
load::register();
// 自动加载,没有找到本地类的
register_shutdown_function('\\poem\\app::appFatal');
// 错误和异常处理
set_error_handler('\\poem\\app::appError');
set_exception_handler('\\poem\\app::appException');
t('POEM_TIME');
$module = defined('NEW_MODULE') ? NEW_MODULE : 'home';
if (!is_dir(APP_PATH . $module)) {
\poem\more\Build::checkModule($module);
}
Route::run();
// 路由管理
self::exec();
// 执行操作
t('POEM_TIME', 0);
if (!config('debug_trace') || IS_AJAX || IS_CLI) {
exit;
}
log::show();
exit;
}
开发者ID:rehorn,项目名称:phppoem,代码行数:27,代码来源:app.php
示例11: _save_api_key
private function _save_api_key($form)
{
$new_key = $form->sharing->api_key->value;
if ($new_key && !l10n_client::validate_api_key($new_key)) {
$form->sharing->api_key->add_error("invalid", 1);
$valid = false;
} else {
$valid = true;
}
if ($valid) {
$old_key = l10n_client::api_key();
l10n_client::api_key($new_key);
if ($old_key && !$new_key) {
message::success(t("Your API key has been cleared."));
} else {
if ($old_key && $new_key && $old_key != $new_key) {
message::success(t("Your API key has been changed."));
} else {
if (!$old_key && $new_key) {
message::success(t("Your API key has been saved."));
}
}
}
log::success(t("gallery"), t("l10n_client API key changed."));
url::redirect("admin/languages");
} else {
// Show the page with form errors
$this->index($form);
}
}
开发者ID:hiwilson,项目名称:gallery3,代码行数:30,代码来源:admin_languages.php
示例12: _update
/**
* @see REST_Controller::_update($resource)
*/
public function _update($photo)
{
access::verify_csrf();
access::required("view", $photo);
access::required("edit", $photo);
$form = photo::get_edit_form($photo);
if ($valid = $form->validate()) {
if ($form->edit_photo->filename->value != $photo->name) {
// Make sure that there's not a conflict
if (Database::instance()->from("items")->where("parent_id", $photo->parent_id)->where("id <>", $photo->id)->where("name", $form->edit_photo->filename->value)->count_records()) {
$form->edit_photo->filename->add_error("conflict", 1);
$valid = false;
}
}
}
if ($valid) {
$photo->title = $form->edit_photo->title->value;
$photo->description = $form->edit_photo->description->value;
$photo->rename($form->edit_photo->filename->value);
$photo->save();
module::event("photo_edit_form_completed", $photo, $form);
log::success("content", "Updated photo", "<a href=\"photos/{$photo->id}\">view</a>");
message::success(t("Saved photo %photo_title", array("photo_title" => p::clean($photo->title))));
print json_encode(array("result" => "success", "location" => url::site("photos/{$photo->id}")));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
开发者ID:hiwilson,项目名称:gallery3,代码行数:31,代码来源:photos.php
示例13: auth
public function auth()
{
if (!identity::active_user()->admin) {
access::forbidden();
}
access::verify_csrf();
$form = self::_form();
$valid = $form->validate();
$user = identity::active_user();
if ($valid) {
module::event("user_auth", $user);
if (!request::is_ajax()) {
message::success(t("Successfully re-authenticated!"));
}
url::redirect(Session::instance()->get_once("continue_url"));
} else {
$name = $user->name;
log::warning("user", t("Failed re-authentication for %name", array("name" => $name)));
module::event("user_auth_failed", $name);
if (request::is_ajax()) {
$v = new View("reauthenticate.html");
$v->form = $form;
$v->user_name = identity::active_user()->name;
json::reply(array("html" => (string) $v));
} else {
self::_show_form($form);
}
}
}
开发者ID:JasonWiki,项目名称:docs,代码行数:29,代码来源:reauthenticate.php
示例14: _update
/**
* @see REST_Controller::_update($resource)
*/
public function _update($photo)
{
access::verify_csrf();
access::required("view", $photo);
access::required("edit", $photo);
$form = photo::get_edit_form($photo);
$valid = $form->validate();
if ($valid = $form->validate()) {
if ($form->edit_item->filename->value != $photo->name || $form->edit_item->slug->value != $photo->slug) {
// Make sure that there's not a name or slug conflict
if ($row = Database::instance()->select(array("name", "slug"))->from("items")->where("parent_id", $photo->parent_id)->where("id <>", $photo->id)->open_paren()->where("name", $form->edit_item->filename->value)->orwhere("slug", $form->edit_item->slug->value)->close_paren()->get()->current()) {
if ($row->name == $form->edit_item->filename->value) {
$form->edit_item->filename->add_error("name_conflict", 1);
}
if ($row->slug == $form->edit_item->slug->value) {
$form->edit_item->slug->add_error("slug_conflict", 1);
}
$valid = false;
}
}
}
if ($valid) {
$photo->title = $form->edit_item->title->value;
$photo->description = $form->edit_item->description->value;
$photo->slug = $form->edit_item->slug->value;
$photo->rename($form->edit_item->filename->value);
$photo->save();
module::event("item_edit_form_completed", $photo, $form);
log::success("content", "Updated photo", "<a href=\"{$photo->url()}\">view</a>");
message::success(t("Saved photo %photo_title", array("photo_title" => html::purify($photo->title))));
print json_encode(array("result" => "success"));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
开发者ID:scarygary,项目名称:gallery3,代码行数:38,代码来源:photos.php
示例15: test
public function test()
{
$username = "howdy";
$password = "123456";
$email = "[email protected]";
$username2 = "bla2";
$password2 = "pass2";
$email2 = "[email protected]";
$username3 = "gue";
$password3 = "pass3";
$email3 = "[email protected]";
user::create_new_user($username, $password, $email);
$this->assertEquals(1, user::getNumberOfUsers(), "number of users is not correct after adding a new user");
user::create_new_user($username2, $password2, $email2);
$this->assertEquals(2, user::getNumberOfUsers(), "number of users is not correct after adding a new user");
user::create_new_user($username3, $password3, $email3);
$this->assertEquals(3, user::getNumberOfUsers(), "number of users is not correct after adding a new user");
$user1ID = user::getUserByUsername($username)['id'];
$user2ID = user::getUserByUsername($username2)['id'];
$user3ID = user::getUserByUsername($username3)['id'];
$uuid1 = "352584060201362";
$this->assertTrue(safe_input::is_valid_uuid($uuid1), "safe_input::is_valid_uuid()");
$ip1 = '196.168.2.16';
$this->assertTrue(safe_input::is_valid_ip($ip1), "safe_input::is_valid_ip()");
$this->assertEquals(0, log::get_logs_count(), "[get_logs_count()]");
$this->assertTrue(log::addNewLog($user1ID, $ip1, $uuid1), "[log::addNewLog()]");
$this->assertEquals(1, log::get_logs_count(), "[get_logs_count()]");
$this->assertTrue(log::addNewLog($user1ID, $ip1, $uuid1), "[log::addNewLog()]");
$this->assertEquals(2, log::get_logs_count(), "[get_logs_count()]");
//$this->assertTrue(log::deleteSimilarLogs(),"[deleteSimilarLogs()]") ;
//$this->assertEquals(1,log::get_logs_count(),"[get_logs_count()]") ;
}
开发者ID:uunuu,项目名称:dot_boxes,代码行数:32,代码来源:table_logTest.php
示例16: doAction
public function doAction()
{
if (empty($this->source)) {
$this->result['error'][] = array("code" => -1, "message" => "missing source segment");
}
if (empty($this->target)) {
$this->result['error'][] = array("code" => -2, "message" => "missing target segment");
}
if (empty($this->source_lang)) {
$this->result['error'][] = array("code" => -3, "message" => "missing source lang");
}
if (empty($this->target_lang)) {
$this->result['error'][] = array("code" => -2, "message" => "missing target lang");
}
if (!empty($this->result['error'])) {
return -1;
}
if (!empty($this->id_translator)) {
$this->key = $this->calculateMyMemoryKey($this->id_translator);
log::doLog("key is {$this->key}");
}
$set_results = addToMM($this->source, $this->target, $this->source_lang, $this->target_lang, $this->id_translator, $this->key);
$this->result['code'] = 1;
$this->result['data'] = "OK";
}
开发者ID:Tucev,项目名称:casmacat-frontend,代码行数:25,代码来源:setContributionController.php
示例17: instance
public static function instance()
{
if (!isset(self::$log)) {
self::$log = new log();
}
return self::$log;
}
开发者ID:ChaosCoo,项目名称:gserver,代码行数:7,代码来源:log.php
示例18: doAction
public function doAction()
{
//check if id file and job is a number
//if (is_numeric($this->id_file) && is_numeric($this->id_job))
//convert id_file and id_job into a numbers
$id_file = (int) $this->id_file;
$id_job = (int) $this->id_job;
ini_set('max_execution_time', 6000);
$ret = -1;
if (substr(php_uname(), 0, 7) == "Windows") {
log::doLog("windows");
$ret = pclose(popen("start C:\\wamp\\bin\\php\\php5.4.3\\php " . INIT::$MODEL_ROOT . "/exportLog.php " . $id_file . " " . $id_job . " 1", "r"));
} else {
$ret = pclose(popen("nohup php " . INIT::$MODEL_ROOT . "/exportLog.php " . $id_file . " " . $id_job . " 1 &", "r"));
}
log::doLog("CASMACAT: return exportLog: " . $ret);
ini_set('max_execution_time', 30);
// $this->filename ="log_id".$this->id_file."_".$this->file_name.".xml";
// header('Content-Type: text/xml; charset=UTF-8');
// header('Content-Disposition: attachment; filename="' . $this->file_name . '.xml"');
//
// //log::doLog("CASMACAT: file: ".INIT::$LOG_DOWNLOAD . "/" .$this->filename);
//
// $this->content = file_get_contents(INIT::$LOG_DOWNLOAD . "/" . $this->filename);
if ($ret == "END") {
$this->result['code'] = 0;
$this->result['data'] = "OK";
} else {
$this->result['errors'] = "It is not possible to get the log file";
$this->result['code'] = -1;
}
}
开发者ID:Tucev,项目名称:casmacat-frontend,代码行数:32,代码来源:createLogDownloadController.php
示例19: debug
/**
* debug a message. Writes to stdout and to log file
* if debug = 1 is set in config
* @param string $message
*/
public static function debug($message)
{
if (config::getMainIni('debug')) {
log::error($message);
return;
}
}
开发者ID:remyoucef,项目名称:noiphp,代码行数:12,代码来源:log.php
示例20: add_photo
public function add_photo($id)
{
$album = ORM::factory("item", $id);
access::required("view", $album);
access::required("add", $album);
access::verify_csrf();
$file_validation = new Validation($_FILES);
$file_validation->add_rules("Filedata", "upload::valid", "upload::type[gif,jpg,png,flv,mp4]");
if ($file_validation->validate()) {
// SimpleUploader.swf does not yet call /start directly, so simulate it here for now.
if (!batch::in_progress()) {
batch::start();
}
$temp_filename = upload::save("Filedata");
try {
$name = substr(basename($temp_filename), 10);
// Skip unique identifier Kohana adds
$title = item::convert_filename_to_title($name);
$path_info = pathinfo($temp_filename);
if (array_key_exists("extension", $path_info) && in_array(strtolower($path_info["extension"]), array("flv", "mp4"))) {
$movie = movie::create($album, $temp_filename, $name, $title);
log::success("content", t("Added a movie"), html::anchor("movies/{$movie->id}", t("view movie")));
} else {
$photo = photo::create($album, $temp_filename, $name, $title);
log::success("content", t("Added a photo"), html::anchor("photos/{$photo->id}", t("view photo")));
}
} catch (Exception $e) {
unlink($temp_filename);
throw $e;
}
unlink($temp_filename);
}
print "File Received";
}
开发者ID:krgeek,项目名称:gallery3,代码行数:34,代码来源:simple_uploader.php
注:本文中的log类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论