当前位置: 首页>>代码示例>>PHP>>正文


PHP KLogger::instance方法代码示例

本文整理汇总了PHP中KLogger::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP KLogger::instance方法的具体用法?PHP KLogger::instance怎么用?PHP KLogger::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KLogger的用法示例。


在下文中一共展示了KLogger::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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 ");
     }
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:34,代码来源:usergameaction.class.php

示例2: 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 ");
     }
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:33,代码来源:userxplog.class.php

示例3: __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();
 }
开发者ID:jnan77,项目名称:metaq-php,代码行数:8,代码来源:MetaQ.php

示例4: __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);
     }
 }
开发者ID:ed-ro0t,项目名称:php-mpos,代码行数:8,代码来源:logger.class.php

示例5: 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;
     }
 }
开发者ID:niieani,项目名称:nandu,代码行数:11,代码来源:MIDIfy.php

示例6: __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;
 }
开发者ID:ntoskrnl,项目名称:ukraine,代码行数:11,代码来源:logger.php

示例7: 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;
 }
开发者ID:niieani,项目名称:nandu,代码行数:13,代码来源:AuralizeNumbers.php

示例8: __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("/");
     }
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:15,代码来源:basecontroller.php

示例9: 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);
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:17,代码来源:user.class.php

示例10: dirname

<?php

# Should log to the same directory as this file
require dirname(__FILE__) . '/../src/KLogger.php';
$log = KLogger::instance(dirname(__FILE__), KLogger::DEBUG);
$log->logInfo('Info Test');
$log->logNotice('Notice Test');
$log->logWarn('Warn Test');
$log->logError('Error Test');
$log->logFatal('Fatal Test');
$log->logAlert('Alert Test');
$log->logCrit('Crit test');
$log->logEmerg('Emerg Test');
开发者ID:helpfulrobot,项目名称:silverstripe-syncrotron,代码行数:13,代码来源:example.php

示例11: basename

$cron_name = basename($_SERVER['PHP_SELF'], '.php');
// Include our configuration (holding defines for the requires)
require_once BASEPATH . '../include/bootstrap.php';
require_once BASEPATH . '../include/version.inc.php';
// Command line switches
array_shift($argv);
foreach ($argv as $option) {
    switch ($option) {
        case '-f':
            $monitoring->setStatus($cron_name . "_disabled", "yesno", 0);
            $monitoring->setStatus($cron_name . "_active", "yesno", 0);
            break;
    }
}
// Load 3rd party logging library for running crons
$log = KLogger::instance(BASEPATH . '../logs/' . $cron_name, KLogger::INFO);
$log->LogDebug('Starting ' . $cron_name);
// Load the start time for later runtime calculations for monitoring
$cron_start[$cron_name] = microtime(true);
// Check if our cron is activated
if ($monitoring->isDisabled($cron_name)) {
    $log->logFatal('Cronjob is currently disabled due to errors, use -f option to force running cron.');
    $monitoring->endCronjob($cron_name, 'E0018', 1, true, false);
}
// Mark cron as running for monitoring
$log->logDebug('Marking cronjob as running for monitoring');
if (!$monitoring->startCronjob($cron_name)) {
    $log->logFatal('Unable to start cronjob: ' . $monitoring->getCronError());
    exit;
}
// Check if we need to halt our crons due to an outstanding upgrade
开发者ID:noncepool,项目名称:php-mpos,代码行数:31,代码来源:shared.inc.php

示例12: __construct

 public function __construct($log_directory, $debug_level)
 {
     $level = $debug_level != null ? $debug_level : \KLogger::DEBUG;
     $this->log = \KLogger::instance($log_directory, $level);
 }
开发者ID:pkdevbox,项目名称:Headstart,代码行数:5,代码来源:FileLogger.php

示例13: syncData

 /**
  * Importiert die Daten aus der aus Kufer SQL exportierten XML Datei.
  * @global mixed[] $REX Redaxo Variable
  */
 public static function syncData()
 {
     global $REX;
     // error reporting
     if (KUFER_IMPORT_DEBUG_MODE) {
         ini_set('display_startup_errors', 1);
         ini_set('display_errors', 1);
         error_reporting(-1);
     } else {
         ini_set('display_startup_errors', 0);
         ini_set('display_errors', 0);
         error_reporting(0);
     }
     include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_generate.inc.php';
     // init logger
     $logFile = KUFER_IMPORT_LOG_FILE_PATH;
     $log = KLogger::instance($logFile, KLogger::INFO);
     // PHP Log Einstellungen werden ausgelesen, damit sie später zurückgesetzt werden können
     $phpLogErrors = ini_get('log_errors');
     $phperrorLog = ini_get('error_log');
     ini_set('log_errors', 1);
     ini_set('error_log', $log->getLogFilePath());
     $log->logInfo('======================================== START Kufer Import ========================================');
     $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
     $xmlUrl = $REX['ADDON']['kufer_import']['settings']['xml_url'];
     // XML Datei auslesen
     $xmlString = file_get_contents($xmlUrl, false, $context);
     $kufer_kurse = simplexml_load_string($xmlString, null, LIBXML_NOCDATA);
     // Bestehende Kurse auslesen, falls sie aktualisiert werden
     require_once $REX['INCLUDE_PATH'] . '/addons/d2u_kurse/classes/class.kurs.inc.php';
     $kurse = Kurs::getAll($REX['TABLE_PREFIX'], FALSE);
     // Nur die Kurse sind von Interesse, die durch kufer_import hinzugefügt wurden
     $importierte_kurse = array();
     foreach ($kurse as $kurs) {
         if ($kurs->import == KUFER_IMPORT_STRING) {
             $importierte_kurse[$kurs->kursnummer] = $kurs;
         }
     }
     // Kufer Kurse hinzufügen oder aktualisieren
     $counter_new = 0;
     $counter_update = 0;
     $kurskategorien = Kurskategorie::getAll($kurs->table_prefix, 0, FALSE);
     $terminkategorien = Terminkategorie::getAll($kurs->table_prefix, FALSE);
     $zielgruppen = Zielgruppe::getAll($kurs->table_prefix, FALSE);
     foreach ($kufer_kurse->kurs as $kufer_kurs) {
         // Kurse, die ausfallen werden nicht importiert
         if (isset($kufer_kurs->ausfall)) {
             continue;
         }
         // Kurse, die schon begonnen haben werden nicht importiert
         if (isset($kufer_kurs->beginndat) && $kufer_kurs->beginndat != "") {
             $d = explode(".", $kufer_kurs->beginndat);
             $beginndat_time = mktime(0, 0, 0, $d[1], $d[0], $d[2]);
             if (strtotime("-1 day") > $beginndat_time) {
                 continue;
             }
         }
         $kurs = Kurs::factory($REX['TABLE_PREFIX']);
         // Wurde Kurs schon einmal importiert?
         if (isset($kufer_kurs->knr)) {
             $kufer_kursnummer = (string) $kufer_kurs->knr;
             if (array_key_exists($kufer_kursnummer, $importierte_kurse)) {
                 // Kurs aus Array holen ...
                 $kurs = $importierte_kurse[$kufer_kursnummer];
                 // ... und entfernen, denn übrige Kurse werden später gelöscht
                 unset($importierte_kurse[$kufer_kursnummer]);
             }
         }
         // Werte aus Import holen und in Kursobjekt schreiben
         // Kursnummer
         if (isset($kufer_kurs->knr)) {
             $kurs->kursnummer = (string) $kufer_kurs->knr;
         }
         // Titel
         if (isset($kufer_kurs->titelkurz) && $kufer_kurs->titelkurz != "") {
             $kurs->titel = (string) $kufer_kurs->titelkurz;
         } else {
             if (isset($kufer_kurs->titellang) && $kufer_kurs->titellang != "") {
                 $kurs->titel = (string) $kufer_kurs->titellang;
             }
         }
         // Beschreibung
         $kurs->beschreibung = "";
         // Zuerst Zurücksetzen
         if (isset($kufer_kurs->titellang) && $kufer_kurs->titellang != "") {
             $kurs->beschreibung = "<p><b>" . (string) $kufer_kurs->titellang . "</b></p>";
         }
         if (isset($kufer_kurs->web_info) && $kufer_kurs->web_info != "") {
             $kurs->beschreibung .= "<p>" . nl2br($kufer_kurs->web_info) . "</p>";
         } else {
             if (isset($kufer_kurs->inhalt) && $kufer_kurs->inhalt != "") {
                 $kurs->beschreibung .= "<p>" . nl2br($kufer_kurs->inhalt) . "</p>";
             }
         }
         if (isset($kufer_kurs->material) && $kufer_kurs->material != "") {
             $kurs->beschreibung .= "<p><b>Material</b></p>";
//.........这里部分代码省略.........
开发者ID:TobiasKrais,项目名称:d2u_kurse,代码行数:101,代码来源:class.kufer_sync.inc.php

示例14: syncData

 public static function syncData()
 {
     global $REX, $I18N;
     // error reporting
     if (HR4YOU_SYNC_DEBUG_MODE) {
         ini_set('display_startup_errors', 1);
         ini_set('display_errors', 1);
         error_reporting(-1);
     } else {
         ini_set('display_startup_errors', 0);
         ini_set('display_errors', 0);
         error_reporting(0);
     }
     // necessary stuff so mediapool function can work properly in frontend
     $REX['USER'] = new rex_fe_user();
     $I18N = rex_create_lang($REX['LANG']);
     include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_generate.inc.php';
     include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_mediapool.inc.php';
     // init logger
     $logFile = HR4YOU_SYNC_LOG_FILE_PATH;
     $log = KLogger::instance($logFile, KLogger::INFO);
     $phpLogErrors = ini_get('log_errors');
     $phperrorLog = ini_get('error_log');
     ini_set('log_errors', 1);
     ini_set('error_log', $log->getLogFilePath());
     $log->logInfo('======================================== START HR4YOU SYNC ========================================');
     $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
     $xmlUrl = $REX['ADDON']['hr4you_sync']['settings']['xml_url'];
     $defaultClangId = $REX['ADDON']['hr4you_sync']['settings']['default_clang_id'];
     $defaultArticleId = $REX['ADDON']['hr4you_sync']['settings']['default_article_id'];
     $defaultMediaCategoryId = $REX['ADDON']['hr4you_sync']['settings']['default_media_category_id'];
     $defaultJobCategoryId = $REX['ADDON']['hr4you_sync']['settings']['default_job_category_id'];
     $xmlString = file_get_contents($xmlUrl, false, $context);
     $jobs = new SimpleXMLElement($xmlString);
     // remove all previously synced jobs and media files
     $log->logInfo('>> [INF] remove all previously synced jobs and media files');
     $sql = rex_sql::factory();
     $sql->setDebug(HR4YOU_SYNC_DEBUG_MODE);
     rex_hr4you_sync_utils::logQuery($log, $sql, "SELECT * FROM `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_stellen` WHERE hr4you_jobid > 0 ORDER BY stellen_id ASC");
     for ($i = 0; $i < $sql->getRows(); $i++) {
         $sql2 = rex_sql::factory();
         $sql2->setDebug(HR4YOU_SYNC_DEBUG_MODE);
         rex_hr4you_sync_utils::logQuery($log, $sql2, 'DELETE FROM `' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_stellen` WHERE stellen_id = ' . $sql->getValue('stellen_id'));
         rex_hr4you_sync_utils::logQuery($log, $sql2, 'DELETE FROM `' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_stellen_lang` WHERE stellen_id = ' . $sql->getValue('stellen_id'));
         // delete media
         $log->logInfo('>> [INF] delete media: ' . $sql->getValue('bild'));
         $media = OOMedia::getMediaByFileName($sql->getValue('bild'));
         if (is_object($media)) {
             $mediaInUse = $media->isInUse();
             if ($mediaInUse === false) {
                 if ($media->delete() !== false) {
                     // success
                     $log->logInfo('>> [INF] media deleted');
                 } else {
                     // failed
                     $log->logError('>> [ERR] media not deleted');
                 }
             } else {
                 $log->logInfo('>> [INF] media not deleted because still in use');
             }
         } else {
             $log->logInfo('>> [INF] media does not exist anymore');
         }
         $sql->next();
     }
     // add jobs
     $log->logInfo('>> [INF] add jobs');
     foreach ($jobs->entry as $job) {
         $sql = rex_sql::factory();
         $sql->setDebug(HR4YOU_SYNC_DEBUG_MODE);
         rex_hr4you_sync_utils::logQuery($log, $sql, "SELECT * FROM `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_stellen` WHERE hr4you_jobid = " . $job->jobid);
         if ($sql->getRows() < 1) {
             // for safety reasons: only addon new job if it does not already exist
             // copy media file
             $log->logInfo('>> [INF] copy media file');
             $pathInfo = pathinfo($job->kopfgrafik_url);
             $originalFile = $pathInfo['basename'];
             $originalFileWithPath = $REX['MEDIAFOLDER'] . DIRECTORY_SEPARATOR . $originalFile;
             $mediaFile = self::rex_mediapool_filename_nosubindex($pathInfo['basename'], false);
             $mediaFileWithPath = $REX['MEDIAFOLDER'] . DIRECTORY_SEPARATOR . $mediaFile;
             if (!file_exists($mediaFileWithPath)) {
                 if (copy($job->kopfgrafik_url, $mediaFileWithPath)) {
                     $log->logInfo('>> [INF] media file sucessfully copied because it does not exist');
                 }
                 if (chmod($mediaFileWithPath, $REX['FILEPERM'])) {
                     $log->logInfo('>> [INF] media file chmod to: ' . $REX['FILEPERM']);
                 }
                 $mpSyncReturn = rex_mediapool_syncFile($mediaFile, $defaultMediaCategoryId, $job->kopfgrafik_name);
                 $log->logInfo('>> [INF] media file synced width return value: ', $mpSyncReturn);
             } else {
                 $log->logInfo('>> [INF] media file already exists');
             }
             // retrieve id of contact by email address
             $log->logInfo('>> [INF] retrieve id of contact by email address');
             $sql2 = rex_sql::factory();
             $sql2->setDebug(HR4YOU_SYNC_DEBUG_MODE);
             rex_hr4you_sync_utils::logQuery($log, $sql2, "SELECT kontakt_id FROM `" . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_kontakt` WHERE email LIKE '" . $job->ap_email . "'");
             if ($sql2->getRows() > 0) {
                 //contact found
                 $contactId = $sql2->getValue('kontakt_id');
//.........这里部分代码省略.........
开发者ID:TobiasKrais,项目名称:d2u_stellenmarkt,代码行数:101,代码来源:class.rex_hr4you_sync.inc.php

示例15: define

<?php

define("__ROOT__", __DIR__ . "/../");
require_once __ROOT__ . 'config/constants.php';
require_once __ROOT__ . '/vendors/KLogger.php';
$log = KLogger::instance(KLOGGER_PATH . "queue_high/", KLogger::DEBUG);
if (isset($_POST["data"])) {
    $data = $_POST["data"];
    $obj = json_decode($data);
    $log->logInfo("processHigh > " . $data);
    $method = $obj->method;
    $action = $obj->action;
    unset($obj->method);
    unset($obj->action);
    $processorClass = ucfirst(strtolower($method)) . "Processor";
    if (!file_exists(__ROOT__ . "processor/" . $method . ".class.php")) {
        $log->logError("processHigh > method " . $method . " not found!");
        header('HTTP/1.0 404 Not Found');
        exit;
    }
    require __ROOT__ . "processor/" . $method . ".class.php";
    if (class_exists($processorClass)) {
        $processor = new $processorClass();
        if (method_exists($processor, $action)) {
            $vars = array_keys(get_object_vars($processor));
            foreach ($obj as $key => $value) {
                if (in_array($key, $vars)) {
                    $processor->{$key} = $value;
                }
            }
            try {
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:31,代码来源:processHigh.php


注:本文中的KLogger::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。