本文整理汇总了PHP中KLogger类的典型用法代码示例。如果您正苦于以下问题:PHP KLogger类的具体用法?PHP KLogger怎么用?PHP KLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construction for class
*
* @param string $sourceFolder : end with slash '/'
* @param string $sourceName
* @param string $destFolder : end with slash '/'
* @param string $destName
* @param int $maxWidth
* @param int $maxHeight
* @param string $cropRatio
* @param int $quality
* @param string $color
*
* @return ImageResizer
*/
function __construct($sourceFolder, $sourceName, $destFolder, $destName, $maxWidth = 0, $maxHeight = 0, $cropRatio = '', $quality = 90, $color = '')
{
$this->sourceFolder = $sourceFolder;
$this->sourceName = $sourceName;
$this->destFolder = $destFolder;
$this->destName = $destName;
$this->maxWidth = $maxWidth;
$this->maxHeight = $maxHeight;
$this->cropRatio = $cropRatio;
$this->quality = $quality;
$this->color = $color;
$klog = new KLogger(Yii::getPathOfAlias('common.log') . DIRECTORY_SEPARATOR . 'resize_image_log', KLogger::INFO);
if (!file_exists($this->sourceFolder . $this->sourceName)) {
echo 'Error: image does not exist: ' . $this->sourceFolder . $this->sourceName;
$this->file_error = true;
$klog->LogInfo('Error: image does not exist: ' . $this->sourceFolder . $this->sourceName);
return null;
}
$size = GetImageSize($this->sourceFolder . $this->sourceName);
$mime = $size['mime'];
// Make sure that the requested file is actually an image
if (substr($mime, 0, 6) != 'image/') {
echo 'Error: requested file is not an accepted type: ' . $this->sourceFolder . $this->sourceName;
$klog->LogInfo('Error: requested file is not an accepted type: ' . $this->sourceFolder . $this->sourceName);
$this->file_error = true;
return null;
}
$this->size = $size;
if ($color != '') {
$this->color = preg_replace('/[^0-9a-fA-F]/', '', $color);
} else {
$this->color = FALSE;
}
}
示例2: logQuery
/**
* Führt eine SQL Query aus und schreibt sie in die Logdatei.
* @param KLogger $log Logdatei Objekt
* @param rex_sql $sql SQL Objekt
* @param String $query SQL Query
*/
public static function logQuery(&$log, &$sql, $query)
{
$sql->setQuery($query);
if ($sql->getError() == '') {
$log->logInfo('>> [QRY] ' . htmlentities($query));
} else {
$log->logError('>> [QRY] ' . htmlentities($query));
$log->logError('>> [QRY] ' . $sql->getError());
}
}
示例3: __construct
/**
* Initialize project by calling get_config on the RW server and saving the response.
*
* @param int $id PK of a project
* @throws Exception if valid config objects (device, session, project) are not returned from RW
*/
function __construct(array $config = array())
{
$this->CI =& get_instance();
$this->log = KLogger::syslog(KLogger::DEBUG, TRUE);
if (isset($config['id'])) {
$this->project_id = $config['id'];
}
// if we don't have an RW session-id, call get config and push the device and project
// values into the CI session. If we do have an RW session-id, pull those values
// from the CI session.
if (FALSE === ($this->rw_session_id = $this->CI->session->userdata('rw_session_id'))) {
$this->config(json_decode($this->do_curl('get_config')));
$this->CI->session->set_userdata('rw_session_id', $this->rw_session_id);
$this->CI->session->set_userdata('rw_device', $this->device);
$this->CI->session->set_userdata('rw_project', $this->project);
} else {
$this->rw_session_id = $this->CI->session->userdata('rw_session_id');
$this->device = $this->CI->session->userdata('rw_device');
$this->project = $this->CI->session->userdata('rw_project');
}
// we can't do anything without device, session and project objects
if (!($this->device && $this->rw_session_id && $this->project)) {
throw new Exception("Roundware could not be initialized with the given project ID.");
}
}
示例4: lost
public function lost()
{
$log = KLogger::instance(KLOGGER_PATH . "processors/", KLogger::DEBUG);
$log->logInfo("usergameaction > lost > start userId : " . $this->userId . " opponentId : " . $this->opponentId . " action : " . $this->action_ . " time : " . $this->time . " room groupId : " . $this->roomGroupId . " gameId : " . $this->gameId . " normal : " . $this->normal . " type : " . $this->type . " double : " . $this->double);
if (!empty($this->userId)) {
$user = GameUsers::getGameUserById($this->userId);
if (!empty($user)) {
$userId = $user->getUserId();
if (!empty($userId)) {
$user->getUserLevel();
$opponent = GameUsers::getGameUserById($this->opponentId);
$opponentId = null;
if (!empty($opponent)) {
$opponentId = $opponent->getUserId();
$opponent->getUserLevel();
}
$result = GameUtils::gameResult($user, $opponent, $this->roomGroupId, $this->action_, $this->gameId, $this->double, $this->normal, $this->type, $this->time);
if (!empty($result) && $result->success) {
$log->logInfo("usergameaction > lost > success ");
} else {
$log->logError("usergameaction > lost > error : " . $result->result);
}
unset($userId);
unset($user);
} else {
$log->logError("usergameaction > lost > user Id is empty ");
}
} else {
$log->logError("usergameaction > lost > user Id is empty ");
}
} else {
$log->logError("usergameaction > lost > user Id is empty ");
}
}
示例5: log
public function log()
{
$log = KLogger::instance(KLOGGER_PATH . "processors/", KLogger::DEBUG);
$log->logInfo("userxplog > log > start userId : " . $this->userId . " xp : " . $this->xp . " type : " . $this->type . " time : " . $this->time . " gameId : " . $this->gameId . " result : " . $this->result . " opponentId : " . $this->opponentId);
if (!empty($this->userId)) {
$userXPLog = new GameUserXpLog();
$userXPLog->setUserId($this->userId);
$userXPLog->setXp($this->xp);
$userXPLog->setTime($this->time);
$userXPLog->setType($this->type);
$userXPLog->setGameId($this->gameId);
$userXPLog->setResult($this->result);
$userXPLog->setOpponentId($this->opponentId);
try {
$user = GameUsers::getGameUserById($this->userId);
if (!empty($user)) {
$userXPLog->setUserLevel($user->userLevelNumber);
$userXPLog->setUserCoin($user->coins);
//$userCoinLog->setUserSpentCoin($user->opponentId);
}
} catch (Exception $exc) {
$log->logError("userxplog > log > User Error : " . $exc->getTraceAsString());
}
try {
$userXPLog->insertIntoDatabase(DBUtils::getConnection());
$log->logInfo("userxplog > log > Success");
} catch (Exception $exc) {
$log->logError("userxplog > log > Error : " . $exc->getTraceAsString());
}
} else {
$log->logError("userxplog > log > user Id is empty ");
}
}
示例6: __construct
public function __construct()
{
date_default_timezone_set("PRC");
self::$log = \KLogger::instance(dirname(__FILE__) . "/../log", \KLogger::DEBUG);
require_once '../config/Config.php';
$this->config = $METAQ_CONFIG;
$this->initPartitionList();
}
示例7: __construct
public function __construct($config)
{
if ($config['logging']['enabled'] && $config['logging']['level'] > 0) {
$this->KLogger = KLogger::instance($config['logging']['path'] . '/website', $config['logging']['level']);
$this->logging = true;
$this->floatStartTime = microtime(true);
}
}
示例8: __construct
public function __construct($class = "GLOBAL", $user = "_UKRAINE_", $prefix = "")
{
global $LOGS_PATH;
global $LOGS_SEVERITY;
if (!isset(Logger::$log)) {
Logger::$log = KLogger::instance($LOGS_PATH, $LOGS_SEVERITY);
}
$this->class = $class;
$this->user = $user;
$this->prefix = $prefix;
}
示例9: saveMIDItoFile
public function saveMIDItoFile()
{
//$this->filename = base_convert(mt_rand(), 10, 36);
if($this->filenameSet === true)
{
$this->midi->saveMidFile($this->filepath.'.mid', 0666);
if (defined('DEBUG')) $log = KLogger::instance(dirname(DEBUG), KLogger::DEBUG);
if (defined('DEBUG')) $log->logInfo("Saved MIDI to file: $this->filepath");
return true;
}
}
示例10: generateAudio
public function generateAudio($filepath)
{
//we could also make use of FIFOs:
//http://stackoverflow.com/questions/60942/how-can-i-send-the-stdout-of-one-process-to-multiple-processes-using-preferably
$command = '/usr/bin/timidity -A110 -Ow --verbose=-2 --reverb=f,100 --output-file=- '.$filepath.'.mid | tee >(lame --silent -V6 - '.$filepath.'.mp3) | oggenc -Q -q1 -o '.$filepath.'.ogg -';
//file_put_contents('command', $command);
if (defined('ASYNCHRONOUS_LAUNCH')) $this->launchBackgroundProcess('/bin/bash -c "'.$command.'"');
else shell_exec('/bin/bash -c "'.$command.'"');
if (defined('DEBUG')) $log = KLogger::instance(dirname(DEBUG), KLogger::DEBUG);
if (defined('DEBUG')) $log->logInfo("Converted MIDI to audio files with the command: $command");
return true;
}
示例11: __construct
public function __construct($template, $action, $urlValues, $standalone = false, $signinRequired = false)
{
$this->action = $action;
$this->urlValues = $urlValues;
$this->template = $template;
$this->_standalone = $standalone;
$this->log = KLogger::instance(KLOGGER_PATH, KLogger::DEBUG);
$this->language = LANG_TR_TR;
if (!isset($_SESSION)) {
session_start();
}
if ($signinRequired) {
$this->redirect("/");
}
}
示例12: updateImage
public function updateImage()
{
$log = KLogger::instance(KLOGGER_PATH . "processors/", KLogger::DEBUG);
$log->logInfo("user > updateImage > start userId : " . $this->userId);
try {
$userId = $this->userId;
if (!empty($userId)) {
$result = UserProfileImageUtils::updateUserImage($userId);
$log->logInfo("user > updateImage >userId : " . $this->userId . " Result " . json_encode($result));
} else {
$log->logError("user > updateImage > start userId : " . $this->userId . " user found user id empty");
}
} catch (Exception $exc) {
$log->logError("user > updateImage > error userId : " . $this->userId . " Error :" . $exc->getMessage());
}
$log->logInfo("user > updateImage > finished userId : " . $this->userId);
}
示例13: KLogger
#!/usr/bin/php
<?php
// read mails from internal bounce mailbox and set invalidEmail=1 for these email addresses
require '/var/www/yoursite/http/variables.php';
require '/var/www/yoursite/http/variablesdb.php';
require_once '/var/www/yoursite/http/functions.php';
require '/var/www/yoursite/http/log/KLogger.php';
$log = new KLogger('/var/www/yoursite/http/log/bounces/', KLogger::INFO);
$mailbox = imap_open('{localhost:993/ssl/novalidate-cert}', 'bounce', 'bounce01$');
$mailbox_info = imap_check($mailbox);
for ($i = 1; $i <= $mailbox_info->Nmsgs; $i++) {
$msg = imap_fetch_overview($mailbox, $i);
$rcpt = $msg[0]->to;
if (substr($rcpt, 0, 6) == 'bounce') {
$target = substr($rcpt, 7);
// exclude 'bounce='
$target = substr($target, 0, -9);
// exclude '@yoursite'
$target = str_replace('=', '@', $target);
// revert '=' to '@'
if ($msg[0]->answered == 0) {
$sql = "UPDATE {$playerstable} SET invalidEmail=1 WHERE invalidEmail=0 AND mail='" . $target . "'";
mysql_query($sql);
$affected = mysql_affected_rows();
$uid = imap_uid($mailbox, $i);
$status = imap_setflag_full($mailbox, $uid, '\\Answered \\Seen', ST_UID);
$log->logInfo('sql=[' . $sql . '] affected=[' . $affected . '] status=[' . $status . ']');
}
}
}
imap_close($mailbox);
示例14: setDateFormat
/**
* Sets the date format used by all instances of KLogger
*
* @param string $dateFormat Valid format string for date()
*/
public static function setDateFormat($dateFormat)
{
self::$_dateFormat = $dateFormat;
}
示例15: KLogger
#!/usr/bin/php
<?php
require '/var/www/yoursite/http/variables.php';
require '/var/www/yoursite/http/variablesdb.php';
require_once '/var/www/yoursite/cron/functions.php';
require '/var/www/yoursite/http/log/KLogger.php';
$log = new KLogger('/var/www/yoursite/http/log/cron/', KLogger::INFO);
// PES
$log->logInfo('runDaily: start');
// delete old log entries
$sql = "DELETE FROM weblm_log_access WHERE accesstime < ( UNIX_TIMESTAMP( ) - (60*60*24*180))";
mysql_query($sql);
$log->logInfo('runDaily: Deleted old log entries: ' . mysql_affected_rows());
// send email with played games to all users that selected this in their profile
$dateday = date("d/m/Y");
$yesterday = date("d/m/Y", time() - 60 * 60 * 12);
$timespan = 60 * 60 * 24;
$playersquery = "select distinct winner from {$gamestable} where deleted='no' " . "AND dateday = '{$yesterday}' " . "UNION " . "select distinct winner2 from {$gamestable} where deleted='no' " . "AND dateday = '{$yesterday}' " . "UNION " . "select distinct loser from {$gamestable} where deleted='no' " . "AND dateday = '{$yesterday}' " . "UNION " . "select distinct loser2 from {$gamestable} where deleted='no' " . "AND dateday = '{$yesterday}' ";
$result = mysql_query($playersquery);
$playerscount = mysql_num_rows($result);
$adminMessage = "";
$sql_total = "select count(*) AS c from {$gamestable} " . "WHERE deleted = 'no' " . "AND dateday = '{$yesterday}' " . "ORDER BY date DESC";
$res_total = mysql_query($sql_total);
$row_total = mysql_fetch_array($res_total);
$count_total = $row_total['c'];
$sql_deleted = "select count(*) AS c from {$gamestable} " . "WHERE deleted = 'yes' " . "AND dateday = '{$yesterday}' " . "ORDER BY date DESC";
$res_deleted = mysql_query($sql_deleted);
$row_deleted = mysql_fetch_array($res_deleted);
$count_deleted = $row_deleted['c'];
while ($row = mysql_fetch_array($result)) {
// for each player that played do...