本文整理汇总了PHP中KLogger::LogError方法的典型用法代码示例。如果您正苦于以下问题:PHP KLogger::LogError方法的具体用法?PHP KLogger::LogError怎么用?PHP KLogger::LogError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KLogger
的用法示例。
在下文中一共展示了KLogger::LogError方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
public static function error($message)
{
if (self::$log == null) {
return;
}
self::$log->LogError($message);
}
示例2: KLogger
//
require_once 'uploaded.class.php';
require_once 'KLogger.php';
$backup_location = "physics@ncds1:/disk1/physics_backup";
$log = new KLogger("log.txt", KLogger::DEBUG);
if (isset($_REQUEST['path']) && !empty($_REQUEST['path'])) {
// prepare destination name
$dstpath = str_replace('/', '@', $_REQUEST['path']);
if (substr($dstpath, -1) != "@") {
$dstpath = $dstpath . "@";
}
$dstpath = $dstpath . $fileName;
$log->LogInfo("Upload: {$filePath} -> {$dstpath}");
$file = new Uploaded($filePath);
$fileid = $file->uploadToNCDS($dstpath);
$log->LogInfo("Uploaded to NCDS Path: {$dstpath} FileID: {$fileid}");
if ($file->makeBackup($dstpath, $backup_location)) {
$log->LogInfo("Backup Successful: {$dstpath} Location: {$backup_location}");
} else {
$log->LogError("Backup Error: {$dstpath} Location: {$backup_location}");
}
if ($fileid) {
$file->saveMappingToDb();
$log->LogInfo("Mapping Saved: {$dstpath} FileId: {$fileid}");
}
// remove tmp
unlink($filePath);
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 300, "message": "Failed to get destination path."}, "id" : "id"}');
}
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
示例3: actionNewimport
public function actionNewimport()
{
//$path = _APP_PATH_ . DS . "data";
//$pathSource = 'E:\phuongnv\Vega\chacha_cloud\src\trunk\chacha\data';
$pathSource = _APP_PATH_ . DS . "data";
try {
$log = new KLogger('LOG_IMPORT_FILE_SONG_PNV', KLogger::INFO);
$log->LogInfo("Start New Import", false);
$model = new AdminImportSongModel();
$importer = self::IMPORT_SONG_CACHE . Yii::app()->user->id;
$result = array();
if (isset($_POST['AdminImportSongModel'])) {
$this->layout = false;
$autoconfirm = Yii::app()->request->getParam('autoconfirm');
$autoconfirm = isset($autoconfirm) ? 1 : 0;
$created_time = $_POST['AdminSongModel']['created_time'];
$updated_time = $_POST['AdminSongModel']['updated_time'];
$path = Yii::app()->params['importsong']['store_path'];
$file_path = $pathSource . DS . "tmp" . DS . $_POST['AdminImportSongModel']['source_path'];
$fileName = explode(DS, $file_path);
$fileName = $fileName[count($fileName) - 1];
if (file_exists($file_path)) {
$count = 0;
$start_row = $_POST['AdminImportSongModel']['start_row'] > 0 ? $_POST['AdminImportSongModel']['start_row'] : 0;
$start_row += self::START_ROW;
$limit_row = 65000;
$limit_row += $start_row;
$log->LogInfo("Start Read File and put Memcache | " . $file_path, false);
$data = new ExcelReader($file_path);
$resultSql = array();
//insert file
$sql = "INSERT INTO import_song_file(file_name,importer,status,created_time)\n \t\t\tVALUE('" . $fileName . "', '{$importer}',0,NOW())\n\t \t\t\t";
$insertFileRess = Yii::app()->db->createCommand($sql)->execute();
$fileImportId = Yii::app()->db->getLastInsertID();
for ($i = $start_row; $i < $limit_row; $i++) {
if ($data->val($i, 'B') != "" && $data->val($i, 'G') != "" && $data->val($i, 'C') != "") {
$stt = $data->val($i, Yii::app()->params['importsong']['excelcolumns']['stt']);
$name = $model->my_encoding($data->val($i, Yii::app()->params['importsong']['excelcolumns']['name']));
$category = $model->my_encoding($data->val($i, Yii::app()->params['importsong']['excelcolumns']['category']));
$sub_category = $model->my_encoding($data->val($i, Yii::app()->params['importsong']['excelcolumns']['sub_category']));
$composer = $model->my_encoding($data->val($i, Yii::app()->params['importsong']['excelcolumns']['composer']));
$artist = $model->my_encoding($data->val($i, Yii::app()->params['importsong']['excelcolumns']['artist']));
$album = $model->my_encoding($data->val($i, Yii::app()->params['importsong']['excelcolumns']['album']));
$path = str_replace('\\', DS, $data->val($i, Yii::app()->params['importsong']['excelcolumns']['path']));
$file = $data->val($i, Yii::app()->params['importsong']['excelcolumns']['file']);
$sql = "(";
$sql .= "'" . $autoconfirm . "'";
$sql .= ",'" . $created_time . "'";
$sql .= ",'" . $updated_time . "'";
$sql .= ",'" . $stt . "'";
$sql .= ",'" . addslashes($name) . "'";
$sql .= ",'" . $category . "'";
$sql .= ",'" . $sub_category . "'";
$sql .= ",'" . addslashes($composer) . "'";
$sql .= ",'" . addslashes($artist) . "'";
$sql .= ",'" . addslashes($album) . "'";
//$sql .= ",'".str_replace('\\', '\\\\', $path)."'";
$sql .= ",'" . addslashes($path) . "'";
//$sql .= ",'".str_replace('\\', '\\\\', $file)."'";
$sql .= ",'" . addslashes($file) . "'";
$sql .= ",'" . $importer . "'";
//$sql .= ",'".str_replace('\\', '\\\\', $file_path)."'";
$sql .= ",'" . addslashes($file_path) . "'";
$sql .= ",'" . $fileImportId . "'";
$sql .= ")";
$resultSql[] = $sql;
$count++;
}
/* if($count==10)
echo '<pre>';print_r($result);die(); */
}
//insert data to db
if ($insertFileRess) {
$sql = "INSERT INTO import_song(autoconfirm,created_time,updated_time,stt,name,category,sub_category,composer,artist,album,path,file,importer,file_name,file_id) VALUES";
$sql .= implode(',', $resultSql);
if (Yii::app()->db->createCommand($sql)->execute()) {
$sql = "UPDATE import_song_file set total_song={$count} WHERE id={$fileImportId}";
Yii::app()->db->createCommand($sql)->execute();
}
//insert false
}
//remove file source after insert
$fileSystem = new Filesystem();
$fileSystem->remove($file_path);
echo CJSON::encode(array('errorCode' => 0, 'errorDesc' => 'Success imported Total Record: ' . count($resultSql)));
} else {
//if ($_POST['AdminImportSongModel']['ajax'])
echo CJSON::encode(array('errorCode' => 1, 'errorDesc' => 'Chưa upload file excel'));
}
Yii::app()->end();
}
} catch (Exception $e) {
$log->LogError("actionAjaxImport | Exception Error: " . $e->getMessage(), false);
echo CJSON::encode(array('errorCode' => 1, 'errorDesc' => 'Chưa upload file excel'));
Yii::app()->end();
}
$uploadModel = new XUploadForm();
$this->render('newimport', array('model' => $model, 'listSong' => $result, 'uploadModel' => $uploadModel));
}
示例4: KLogger
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
include_once $_SERVER['DOCUMENT_ROOT'] . "/eventconfig.php";
require_once CLASSFOLDER . '/KLogger.php';
$log = new KLogger("logFiles/log.log", KLogger::DEBUG);
// Do database work that throws an exception
$log->LogError("An exception was thrown in ThisFunction()");
// Print out some information
$log->LogInfo("Internal Query Time: milliseconds");
// Print out the value of some variables
//$log->LogDebug("User Count: $User_Count");
示例5: requestSaveVenda
public static function requestSaveVenda()
{
try {
$dados = $_POST;
$VendaDao = new VendaDao();
$VendaTO = new VendaTO();
$ReferenciaIntegracaoDao = new ReferenciaIntegracaoDao();
$PrestaShopDao = new PrestaShopDao($dados['id_empreendimento']);
$ProdutoCombinacaoDao = new ProdutoCombinacaoDao();
$ItemVendaDao = new ItemVendaDao();
$ItemVendaTO = new ItemVendaTO();
$refCliente = $ReferenciaIntegracaoDao->get(array('sistema_integrado' => 'PrestaShop', 'tabela' => 'tbl_usuarios', 'id_item_referencia' => $dados['customer']['id'], 'tipo' => 'usuario', 'id_empreendimento' => $dados['id_empreendimento'], 'flg_excluido' => 0));
if ($refCliente) {
$id_cliente = $refCliente['id_item'];
} else {
$id_cliente = NULL;
}
$PagamentoClienteTO = new PagamentoClienteTO();
$PagamentoClienteDao = new PagamentoClienteDao();
$ControlePagamentoVendaTO = new ControlePagamentoVendaTO();
$ControlePagamentoVendaDao = new ControlePagamentoVendaDao();
$ConfiguracaoDao = new ConfiguracaoDao();
$config = $ConfiguracaoDao->getConfiguracoes($dados['id_empreendimento']);
$id_controle_pagamento = $ControlePagamentoVendaDao->saveControlePagamento();
$PagamentoClienteTO->id_usuario = $config['prestashop_id_usuario_padrao'];
$PagamentoClienteTO->id_cliente = $id_cliente;
$PagamentoClienteTO->id_controle_pagamento = $id_controle_pagamento;
$PagamentoClienteTO->obs_pagamento = 'Pagamento PrestaShop';
$PagamentoClienteTO->valor_pagamento = $dados['order']['total_products_wt'];
$PagamentoClienteTO->status_pagamento = 0;
$PagamentoClienteTO->id_empreendimento = $dados['id_empreendimento'];
$PagamentoClienteTO->id_plano_conta = $config['prestashop_id_plano_conta_padrao'];
$PagamentoClienteTO->id_conta_bancaria = $config['prestashop_id_conta_bancaria_padrao'];
$PagamentoClienteTO->data_pagamento = date('Y-m-d H:i:s');
if (strtolower($dados['order']['payment']) == 'cheque') {
$PagamentoClienteTO->id_forma_pagamento = 2;
} else {
$PagamentoClienteTO->id_forma_pagamento = 8;
}
$id_lancamento_entrada = $PagamentoClienteDao->savePagamentoCliente($PagamentoClienteTO);
$ReferenciaIntegracaoPagTO = new ReferenciaIntegracaoTO();
$ReferenciaIntegracaoPagTO->sistema_integrado = 'PrestaShop';
$ReferenciaIntegracaoPagTO->tabela = 'tbl_pagamentos_venda';
$ReferenciaIntegracaoPagTO->id_item = $id_lancamento_entrada;
$ReferenciaIntegracaoPagTO->id_item_referencia = $dados['cart']['id'];
$ReferenciaIntegracaoPagTO->tipo = 'pagamento';
$ReferenciaIntegracaoPagTO->id_empreendimento = $dados['id_empreendimento'];
$ReferenciaIntegracaoDao->save($ReferenciaIntegracaoPagTO);
$produtos = array();
$VendaTO->id_usuario = $config['prestashop_id_usuario_padrao'];
$VendaTO->id_cliente = $id_cliente;
$VendaTO->venda_confirmada = 0;
$VendaTO->id_empreendimento = $dados['id_empreendimento'];
$VendaTO->id_status_venda = 1;
$VendaTO->dta_venda = $dados['order']['date_add'];
$VendaTO->vlr_saldo_anterior = NULL;
$id_venda = $VendaDao->saveVenda($VendaTO);
$ReferenciaIntegracaoTO = new ReferenciaIntegracaoTO();
$ReferenciaIntegracaoTO->sistema_integrado = 'PrestaShop';
$ReferenciaIntegracaoTO->tabela = 'tbl_vendas';
$ReferenciaIntegracaoTO->id_item = $id_venda;
$ReferenciaIntegracaoTO->id_item_referencia = $dados['cart']['id'];
$ReferenciaIntegracaoTO->tipo = 'venda';
$ReferenciaIntegracaoTO->id_empreendimento = $dados['id_empreendimento'];
$ReferenciaIntegracaoDao->save($ReferenciaIntegracaoTO);
foreach ($dados['order']['product_list'] as $value) {
if (isset($value['id_product_attribute'])) {
$refCombinacao = $ReferenciaIntegracaoDao->get(array('sistema_integrado' => 'PrestaShop', 'tabela' => 'tbl_produto_combinacao', 'id_item_referencia' => $value['id_product_attribute'], 'tipo' => 'combinacao', 'id_empreendimento' => $dados['id_empreendimento'], 'flg_excluido' => 0));
if ($refCombinacao) {
$comb = $ProdutoCombinacaoDao->get(null, null, array('tpc.id' => $refCombinacao['id_item']));
if ($comb) {
$id_produto = $comb[0]['id_combinacao'];
}
} else {
$refProduto = $ReferenciaIntegracaoDao->get(array('sistema_integrado' => 'PrestaShop', 'tabela' => 'tbl_produtos', 'id_item_referencia' => $value['id_product'], 'tipo' => 'produto', 'id_empreendimento' => $dados['id_empreendimento'], 'flg_excluido' => 0));
if ($refProduto) {
$id_produto = $refProduto['id_item'];
}
}
}
$ex = (double) $value['price_with_reduction_without_tax'] - (double) $value['wholesale_price'];
$perc_venda_varejo = $ex * 100 / (double) $value['wholesale_price'];
$perc_venda_varejo = $perc_venda_varejo / 100;
$ItemVendaTO->id_venda = $id_venda;
$ItemVendaTO->id_produto = $id_produto;
$ItemVendaTO->valor_real_item = $value['price'];
$ItemVendaTO->vlr_custo = round($value['wholesale_price'], 2);
$ItemVendaTO->perc_margem_aplicada = $perc_venda_varejo;
$ItemVendaTO->desconto_aplicado = 0;
$ItemVendaTO->valor_desconto = 0;
$ItemVendaTO->qtd = $value['quantity'];
$ItemVendaTO->perc_imposto_compra = 0;
$ItemVendaTO->perc_desconto_compra = 0;
$ItemVendaDao->saveItemVenda($ItemVendaTO);
}
} catch (Exception $e) {
$log = new KLogger("logs/logErrorPrestaShop.txt", KLogger::DEBUG);
$log->LogError($e->getMessage() . '- file:' . $e->getFile() . ' - line:' . $e->getLine());
$log->LogDebug(json_encode($_POST));
$log->LogJunp();
//.........这里部分代码省略.........
示例6: header
<?php
$container_name = '';
// Some clients only send HTTP Auth credentials if the server
// responds with a 401 and asks for them.
if (empty($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="CloudFiles Poster"');
header('HTTP/1.0 401 Unauthorized');
exit;
}
// Uses kLogger from https://github.com/katzgrau/KLogger
require_once 'KLogger/src/KLogger.php';
$log = new KLogger(dirname(__FILE__), KLogger::INFO);
$container_name = empty($_GET['container']) ? $container_name : $_GET['container'];
if (empty($container_name)) {
$log->LogError('Container name MUST be set.');
die('Container name MUST be set.');
}
$log->LogInfo('Received ' . $_FILES['filename']['name']);
include 'php-cloudfiles/cloudfiles.php';
// Extract user and api key from the http auth
$username = $_SERVER['PHP_AUTH_USER'];
$api_key = $_SERVER['PHP_AUTH_PW'];
// If there's a ?name= query variable, use that as the file name
$filename = empty($_GET['name']) ? $_FILES['filename']['name'] : $_GET['name'];
// Authenticate with CloudFiles and create our file and container objects
$auth = new CF_Authentication($username, $api_key);
$auth->authenticate();
$conn = new CF_Connection($auth);
$container = $conn->create_container($container_name);
$file = $container->create_object($filename);
示例7: actionAjaxImport
public function actionAjaxImport()
{
@ini_set("max_execution_time", 18000);
try {
$timeStart = time();
$fileId = Yii::app()->request->getParam('fileId', 0);
$log = new KLogger('LOG_IMPORT_FILE_SONG_PNV', KLogger::INFO);
$log->LogInfo("Start Ajax Import", false);
$model = new AdminImportSongModel();
$result = ImportSongModel::getSongsAll($fileId);
$totalRow = count($result);
//echo '<pre>';print_r($result);die();
$path = Yii::app()->params['importsong']['store_path'];
$is_error = 0;
$imported = array();
$notImport = array();
$data = "";
$success = 0;
if ($totalRow > 0) {
$song = $result[0];
$log->LogInfo("Start import | " . CJSON::encode($song), false);
$status = 0;
$insert_id = $model->importSong($song, $path);
$insert_id = !$insert_id ? -1 : $insert_id;
// save inserted id to a string, for updating Updated_time column when finish
if ($insert_id > 0 && !in_array($insert_id, array(2, 3, 4))) {
$this->updateTime($insert_id, $song['updated_time']);
$imported = array('stt' => $song['stt'], 'name' => $song['name'], 'path' => $song['path'], 'songId' => $insert_id);
$this->updateSongImportSource($song['id'], 1, 0, 'Success', $insert_id, $timeStart);
} else {
$errorDesc = array(-1 => 'File không tồn tại', 2 => 'Không save được vào song', 3 => 'Hết quyền upload bài hát', 4 => 'File mp3 trống');
$this->updateSongImportSource($song['id'], 2, $insert_id, $errorDesc[$insert_id], 0, $timeStart);
$is_error = 1;
$notImport = array('stt' => $song['stt'], 'name' => $song['name'], 'path' => $song['path'], 'errorDesc' => $errorDesc[$insert_id]);
//$log->LogInfo('Not import > (' . $song['stt'] . ')' . $song['path'] . $song['file'], false);
}
$data = $this->renderPartial('ajaxResultRow', array('imported' => $imported, 'notImport' => $notImport), true, true);
} else {
//completed
$success = 1;
$log->LogError("Error | " . CJSON::encode($result), false);
}
$dataJson = array('is_error' => $is_error, 'success' => $success, 'data' => $data);
echo CJSON::encode($dataJson);
Yii::app()->end();
} catch (Exception $e) {
$log->LogError("actionAjaxImport | Exception Error: " . $e->getMessage(), false);
$dataJson = array('is_error' => 1, 'success' => 0, 'data' => "actionAjaxImport | Exception Error: " . $e->getMessage());
echo CJSON::encode($dataJson);
Yii::app()->end();
}
exit;
}
示例8: getself
require_once 'tropo.class.php';
// KLogger is a logging class from
// http://codefury.net/projects/klogger/
require_once 'KLogger.php';
$log = new KLogger("log.txt", KLogger::INFO);
// Does the ?record query string exist? If not, this is an incoming call.
if (!array_key_exists('record', $_GET)) {
$tropo = new Tropo();
$tropo->record(array('say' => 'Leave your message at the beep.', 'url' => getself() . '?record'));
print $tropo;
} else {
// Change this path to match the location on your server where you want
// the file to be saved.
$target_path = 'path/to/recording/' . $_FILES['filename']['name'];
if (move_uploaded_file($_FILES['filename']['tmp_name'], $target_path)) {
$log->LogInfo("{$target_path} [{$_FILES['filename']['size']} bytes] was saved");
} else {
$log->LogError("{$target_path} could not be saved.");
}
}
// Simple function to get the full URL of the current script.
function getself()
{
$pageURL = 'http';
$url = $_SERVER["HTTPS"] == "on" ? 'https' : 'http';
$url .= "://" . $_SERVER["SERVER_NAME"];
$url .= $_SERVER["SERVER_PORT"] != "80" ? ':' . $_SERVER["SERVER_PORT"] : '';
$url .= $_SERVER["REQUEST_URI"];
return $url;
}
示例9: elog
function elog($logstr, $type = 'info', $dir = "../logs/")
{
$startweek = date('Y-m-d', time());
$log = new KLogger($dir . $startweek . ".txt", KLogger::INFO);
$user = getSessionUser();
$str = u2utf8('(' . $user . ') ' . $logstr);
switch ($type) {
case 'error':
$log->LogError($str);
break;
default:
$log->LogInfo($str);
break;
}
}
示例10: actionNewimport
public function actionNewimport()
{
//$path = _APP_PATH_ . DS . "data";
//$pathSource = 'E:\phuongnv\Vega\chacha_cloud\src\trunk\chacha\data';
$pathSource = _APP_PATH_ . DS . "data";
$log = new KLogger('LOG_CHECK_SONG_IMPORT', KLogger::INFO);
$log->LogInfo("Start New Import", false);
try {
$model = new AdminImportSongModel();
$importer = self::IMPORT_SONG_CACHE . Yii::app()->user->id;
$result = array();
if (isset($_POST['AdminImportSongModel'])) {
$this->layout = false;
$file_path = $pathSource . DS . "tmp" . DS . $_POST['AdminImportSongModel']['source_path'];
$fileName = explode(DS, $file_path);
$fileName = $fileName[count($fileName) - 1];
if (file_exists($file_path)) {
$log->LogInfo("Start Read File and put Memcache | " . $file_path, false);
$data = new ExcelReader($file_path);
//insert file
$sql = "INSERT INTO import_song_file(file_name,importer,status,created_time,type)\n \t\t\tVALUE('" . $fileName . "', '{$importer}',0,NOW(),'CHECK')\n\t \t\t\t";
$log->LogInfo("SQL: " . $sql, false);
$insertFileRess = Yii::app()->db->createCommand($sql)->execute();
$fileImportId = Yii::app()->db->getLastInsertID();
$i = 1;
$err = 0;
$count = 0;
$total = 0;
$sqlAr = array();
$flag = true;
while ($flag) {
if ($data->val($i, 'A') != "" && $data->val($i, 'B') != "" && $data->val($i, 'C') != "") {
$stt = $data->val($i, 'A');
$songName = $model->my_encoding($data->val($i, 'B'));
$artistName = $model->my_encoding($data->val($i, 'C'));
$artistId = $this->getArtistId($artistName);
$artistId = implode(',', $artistId);
$sqlAr[] = "('{$stt}','" . addslashes($songName) . "', '" . addslashes($artistName) . "', {$fileImportId}, '{$importer}','{$artistId}')";
$count++;
$total++;
} else {
$err++;
}
$i++;
if ($err == 3) {
$flag = false;
}
if ($count == 200 || !$flag) {
$sql = "INSERT INTO import_song(stt,name,artist,file_id,importer,album) VALUES";
$sql .= implode(',', $sqlAr);
$log->LogInfo("SQL: " . $sql, false);
if (Yii::app()->db->createCommand($sql)->execute()) {
//reset
$count = 0;
$sqlAr = array();
}
}
}
$sql = "UPDATE import_song_file set total_song={$total} WHERE id={$fileImportId}";
Yii::app()->db->createCommand($sql)->execute();
//remove file source after insert
/* $fileSystem = new Filesystem();
$fileSystem->remove($file_path); */
echo CJSON::encode(array('errorCode' => 0, 'errorDesc' => 'Success imported Total Record: ' . $total . ' Go to <a href="' . Yii::app()->createUrl('/tools/importSong/index&fileId=' . $fileImportId) . '">Scan</a>'));
} else {
echo CJSON::encode(array('errorCode' => 1, 'errorDesc' => 'File không tồn tại:' . $file_path));
$log->LogInfo("File không tồn tại: " . $file_path, false);
}
Yii::app()->end();
}
} catch (Exception $e) {
echo CJSON::encode(array('errorCode' => 1, 'errorDesc' => 'Exception:' . $e->getMessage()));
$log->LogError("actionAjaxImport | Exception Error: " . $e->getMessage(), false);
Yii::app()->end();
}
$uploadModel = new XUploadForm();
$this->render('newimport', array('model' => $model, 'listSong' => $result, 'uploadModel' => $uploadModel));
}