本文整理汇总了PHP中Logger::Error方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::Error方法的具体用法?PHP Logger::Error怎么用?PHP Logger::Error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::Error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controller_settings
function controller_settings(&$args, $output = "inline")
{
$cfg = $this->root->cfg->FlattenConfig($this->root->cfg->LoadServers($this->root->locations["config"] . "/servers.ini", false));
$vars["tfdev"] = !empty($_COOKIE["tf-dev"]) ? json_decode($_COOKIE["tf-dev"], true) : array();
if (!empty($args["clear"])) {
Logger::Info("Cleared dev settings");
setcookie("tf-dev", NULL, 0, "/");
$vars["tfdev"] = array();
$this->root->cfg->servers = $cfg;
}
if (!empty($args["settings"])) {
$diff_orig = array_diff_assoc_recursive($args["settings"], $cfg);
$diff_curr = array_diff_assoc_recursive($args["settings"], $this->root->cfg->FlattenConfig($this->root->cfg->servers));
$vars["tfdev"]["serveroverrides"] = $diff_orig;
setcookie("tf-dev", json_encode($vars["tfdev"]), time() + 86400 * 365, "/");
// dev cookie persists for a year
if (!empty($diff_curr)) {
foreach ($diff_curr as $setting => $value) {
Logger::Info("Override setting: {$setting} = '{$value}'");
$this->root->cfg->AppendSetting($this->root->cfg->servers, $setting, $value);
}
} else {
Logger::Error("No config differences!");
}
}
$vars["settings"] = $this->root->cfg->FlattenConfig($this->root->cfg->servers);
$vars["container"] = $output == "html";
$ret = $this->GetComponentResponse("./settings.tpl", $vars);
if ($output == "ajax") {
$ret = array("tf_debug_tab_settings" => $ret);
}
return $ret;
}
示例2: LoadModel
static function LoadModel($model)
{
if (isset($this) && $this instanceof OrmManager) {
$me = $this;
} else {
$me = self::singleton();
}
if (!$me->outlet) {
return;
}
$models = explode(",", $model);
//print_pre($models);
$ret = array();
foreach ($models as $model) {
$ormmodel = new OrmModel($model);
$ormmodel->LoadModel();
$ret[$model] = $ormmodel;
if (!empty($ormmodel->classes)) {
$foo = object_to_array($ormmodel->classes);
try {
$me->outlet->getConfig()->addEntities($foo);
} catch (Exception $e) {
Logger::Error("OrmManager: " . $e->GetMessage());
}
}
}
$me->outlet->createClasses();
$me->outlet->createProxies();
return $ret;
}
示例3: setContents
public function setContents($value)
{
System::ensureDir(dirname($this->filename_cache));
if (!$this->isWritable()) {
Logger::Error($this->filename_cache . " is not writable");
return;
}
Logger::Debug("Write cache {$this->filename_cache}");
file_put_contents($this->filename_cache, $value);
}
示例4: lock
function lock($f3)
{
if ($f3->exists('GET.newLockStatus')) {
try {
$db = $f3->get('db');
$newLockStatus = $f3->get('GET.newLockStatus');
Logger::Info($f3, "AdminGet.lock", "Setting lock setting to {$newLockStatus}");
DbWrapper::updateEinstellung($db, 'isLocked', $newLockStatus);
} catch (Exception $e) {
Logger::Error($f3, "AdminGet.lock", "Error: {$e->getMessage()}");
}
}
$f3->reroute('/admin/index');
}
示例5: remove
function remove($f3, $params)
{
$this->ensureAdmin($f3);
$lehrerId = $params['id'];
if ($f3->exists('POST.zeitId')) {
try {
$zeitId = $f3->get('POST.zeitId');
Logger::Info($f3, "AdminPost.remove", "Lehrer: {$lehrerId}, Zeit: {$zeitId}");
DbWrapper::deleteSperrung($f3->get('db'), $lehrerId, $zeitId);
} catch (Exception $e) {
Logger::Error($f3, "AdminPost.remove", "Error: {$e->getMessage()}");
}
}
$f3->reroute('/admin/absences/' . $lehrerId);
}
示例6: release
function release($f3, $params)
{
$lehrerId = $params['id'];
if ($f3->exists('POST.zeitId')) {
try {
$zeitId = $f3->get('POST.zeitId');
$userId = $f3->get('COOKIE.user_id');
Logger::Info($f3, "LehrerPost.release", "Lehrer: {$lehrerId}, Zeit: {$zeitId}, User: {$userId}");
DbWrapper::deleteReservation($f3->get('db'), $lehrerId, $zeitId, $userId);
} catch (Exception $e) {
Logger::Error($f3, "LehrerPost.release", "Lehrer: {$lehrerId}, Error: {$e->getMessage()}");
}
}
$f3->reroute('/lehrer/' . $lehrerId);
}
示例7: login
function login($f3)
{
if ($f3->exists('POST.schueler_name')) {
$schuelerName = $f3->get('POST.schueler_name');
try {
$schuelerId = DbWrapper::getSchuelerIdByName($f3->get('db'), $schuelerName);
Logger::Info($f3, "UserPost.login", "Name: {$schuelerName}, Id: {$schuelerId}");
$f3->set('COOKIE.user_id', $schuelerId);
$f3->set('COOKIE.user_name', $schuelerName);
$f3->reroute('/');
} catch (Exception $e) {
Logger::Error($f3, "UserPost.login", "Name: {$schuelerName}, Error: {$e->getMessage()}");
$f3->reroute('/login');
}
} else {
$f3->reroute('/login');
}
}
示例8: Query
function Query($querid, $query, $postfields = NULL, $extras = NULL)
{
if (!empty($query) && preg_match("/^https?:\\/\\//", $query)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $query);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if ($postfields) {
# $custom_request="POST /boomsvc30/SimpleTxEmail.asmx HTTP/1.1";
# curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $custom_request);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
} else {
curl_setopt($ch, CURLOPT_HTTPGET, 1);
}
if ($extras['timeout']) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $extras['timeout']);
}
if ($extras['headers']) {
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array($extras['headers']));
} else {
curl_setopt($ch, CURLOPT_HEADER, 0);
}
#echo "[QUERY]".$query."[QUERY]";
#echo "[POSTFIELDS]".$postfields ."[POSTFIELDS]";
#echo "[HEADERS]".$extras['headers']."[HEADERS]";
Logger::Notice("Remotefile Wrapper requesting URL: {$query}");
if (!empty($postfields)) {
Logger::Debug($postfields);
}
if (!empty($extras['headers'])) {
Logger::Debug($extras['headers']);
}
$ret = curl_exec($ch);
if (curl_errno($ch)) {
$ret = curl_errno($ch) . "<br />" . curl_error($ch);
Logger::Error($ret);
}
curl_close($ch);
}
#echo "[RETURN]".($ret)."[RETURN]";
return $ret;
}
示例9: handleCallback
public function handleCallback()
{
if ($this->getLocalAccessToken()) {
return true;
}
if (!empty($_GET) && isset($_SESSION['TWITTER_REQUEST_TOKEN'])) {
try {
$consumer = new Zend_Oauth_Consumer($this->config);
$token = $consumer->getAccessToken($_GET, unserialize($_SESSION['TWITTER_REQUEST_TOKEN']));
$this->accessToken = serialize($token);
$_SESSION['TWITTER_ACCESS_TOKEN'] = $this->accessToken;
unset($_SESSION['TWITTER_REQUEST_TOKEN']);
return true;
} catch (Exception $e) {
Logger::Error('Twitter: handleCallback failed: ' . $e->getMessage());
return false;
}
}
return false;
}
示例10: Query
public function Query($queryid, $query, $args = array())
{
Profiler::StartTimer("TwitterWrapper::Query()", 1);
Profiler::StartTimer("TwitterWrapper::Query({$query})", 2);
$method = $responseType = $authNeeded = $twitterCallback = null;
if (array_key_exists('method', $args)) {
$method = $args['method'];
unset($args['method']);
}
if (array_key_exists('responseType', $args)) {
$responseType = $args['responseType'];
unset($args['responseType']);
}
if (array_key_exists('authNeeded', $args)) {
$responseType = $args['authNeeded'];
unset($args['authNeeded']);
}
try {
if ($responseType && $authNeeded && $method) {
$response = $this->twitter->api($query, $args, $responseType, $authNeeded, $method);
} else {
if ($responseType && $authNeeded) {
$response = $this->twitter->api($query, $args, $responseType, $authNeeded);
} else {
if ($responseType) {
$response = $this->twitter->api($query, $args, $responseType);
} else {
$response = $this->twitter->api($query, $args);
}
}
}
} catch (Exception $e) {
Logger::Error($e->getMessage());
}
Profiler::StopTimer("TwitterWrapper::Query()");
Profiler::StopTimer("TwitterWrapper::Query({$query})");
return $response;
}
示例11: Load
/**
* Load a specific config from the database, without walking the heirarchy
*
* @param string $name name of config to load
* @return array
*/
public function Load($name, $role)
{
Profiler::StartTimer("Config::Load()");
$data = DataManager::singleton();
$ret = array();
$this->name = $name;
$this->role = $role;
$ret = $this->GetCobrandidAndRevision();
if (!empty($ret)) {
$result_config = DataManager::Query("db.config.cobrand_config.{$name}.{$role}", "SELECT name,value FROM config.cobrand_config WHERE cobrandid=:cobrandid and role=:role ORDER BY name", array(":cobrandid" => $ret["cobrandid"], ":role" => $role));
if ($result_config && count($result_config->rows) > 0) {
$settings = array();
foreach ($result_config->rows as $config_obj) {
$settings[$config_obj->name] = $config_obj->value;
}
array_set_multi($ret, $settings);
$this->config = $ret;
}
} else {
Logger::Error("Could not find config '{$name}'");
}
Profiler::StopTimer("Config::Load()");
//print_pre($ret);
return $ret;
}
示例12: CacheFlush
function CacheFlush()
{
if ($this->caches["memcache"]["data"]) {
Logger::Error("Flushing all memcache data");
$this->caches["memcache"]["data"]->flush();
return true;
}
return false;
}
示例13: unserialize
function &QueryFetch($queryid, $table, $where = NULL, $extra = NULL)
{
$key = $table;
if ($where !== NULL) {
$key .= "." . $where;
}
$cachedresult = $this->cache->get($key);
if ($cachedresult) {
if (is_string($cachedresult)) {
$ret = unserialize($cachedresult);
} else {
if (is_array($cachedresult)) {
foreach ($cachedresult as $k => $v) {
$ret[$k] = unserialize($v);
}
} else {
Logger::Error("Invalid datatype for '%s' in memcache - expected serialized string, found %s", $key, gettype($cachedresult));
}
}
}
return $ret;
}
示例14: nuevo
//.........这里部分代码省略.........
$id_concurso = null;
}
// Revisar que pueda escribir el codigo fuente
if (!is_dir(PATH_TO_CODIGOS)) {
Logger::error("El directorio : " . PATH_TO_CODIGOS . ", no existe");
return array("result" => "error", "reason" => "El directorio de codigos no existe.");
}
if (!is_writable(PATH_TO_CODIGOS)) {
Logger::error("El directorio " . PATH_TO_CODIGOS . ", no esta accesible (writtable)");
return array("result" => "error", "reason" => "No se puede escribir en el directorio de codigos.");
}
global $db;
$sql = "select probID from Problema where BINARY ( probID = ?) ";
$inputarray = array($request["id_problema"]);
$resultado = $db->Execute($sql, $inputarray);
if ($resultado->RecordCount() == 0) {
return array("result" => "error", "reason" => "El problema no existe.");
}
// si el concurso no es publico, solo un admin puede enviar problemas
$lang_desc = null;
switch ($lang) {
case "java":
$lang_desc = "JAVA";
break;
case "c":
$lang_desc = "C";
break;
case "cpp":
$lang_desc = "C++";
break;
case "py":
$lang_desc = "Python";
break;
case "cs":
$lang_desc = "C#";
break;
case "pl":
$lang_desc = "Perl";
break;
case "php":
$lang_desc = "Php";
break;
default:
return array("result" => "error", "reason" => "\"" . $lang . "\" no es un lenguaje reconocido por Teddy.");
}
if (isset($_SERVER["REMOTE_ADDR"])) {
$ip = $_SERVER["REMOTE_ADDR"];
} else {
$ip = "0.0.0.0";
}
/**
* @todo
* - insertar un nuevo run y obtener el id insertado, como estado, hay que ponerle uploading
**/
if ($id_concurso === null) {
$sql = "INSERT INTO Ejecucion (`userID`, `status`, `probID` , `remoteIP`, `LANG`, `fecha` ) \n\t\t\t\t\t\t\t\t\tVALUES (?, 'WAITING', ?, ?, ?, ?);";
$inputarray = array($usuario, $id_problema, $ip, $lang_desc, date("Y-m-d H:i:s", mktime(date("H"), date("i"))));
} else {
// vamos a verificar que el concurso este activo
$sql = "SELECT CID FROM teddy.Concurso WHERE CID = ? AND NOW() between Inicio AND Final;";
$inputarray = array($id_concurso);
$resultado = $db->Execute($sql, $inputarray);
if ($resultado->RecordCount() == 0) {
return array("result" => "error", "reason" => "El concurso no esta activo.");
}
// vamos a verificar que el problema sea parte de este concurso
$sql = "SELECT CID FROM teddy.Concurso WHERE CID = ? AND Problemas like ?;";
$inputarray = array($id_concurso, "%{$id_problema}%");
$resultado = $db->Execute($sql, $inputarray);
if ($resultado->RecordCount() == 0) {
return array("result" => "error", "reason" => "El problema no es parte del concurso.");
}
$sql = "INSERT INTO Ejecucion (`userID` ,`status`, `probID` , `remoteIP`, `LANG`, `Concurso`, `fecha` ) \n\t\t\t\t\t\t\t\t\tVALUES (?, 'WAITING', ?, ?, ?, ?, ?);";
$inputarray = array($usuario, $id_problema, $ip, $lang_desc, $id_concurso, date("Y-m-d H:i:s", mktime(date("H"), date("i"))));
}
$result = $db->Execute($sql, $inputarray);
// Si hacemos esto $execID = $db->Insert_ID( ); hay un Overflow porque los ids son muy grandes
$sql = "select execID from Ejecucion where ( userId = ? ) order by fecha DESC LIMIT 1";
$inputarray = array($usuario);
try {
$resultado = $db->Execute($sql, $inputarray)->GetArray();
$execID = $resultado[0]["execID"];
} catch (exception $e) {
Logger::error($e);
return array("result" => "error", "reason" => "Error al hacer la consulta");
}
if (!empty($_FILES)) {
if (!move_uploaded_file($_FILES['Filedata']['tmp_name'], PATH_TO_CODIGOS . $execID . "." . $lang)) {
return array("result" => "error", "reason" => "Error al subir el archivo");
}
} else {
// Crear un archivo y escribir el contenido
if (file_put_contents(PATH_TO_CODIGOS . "/" . $execID . "." . $lang, $request['plain_source']) === false) {
Logger::Error("file_put_contents() fallo, tal vez no puedo escribir en :" . PATH_TO_CODIGOS);
return array("result" => "error");
}
}
Logger::info("Nueva ejecucion " . $execID);
return array("result" => "ok", "execID" => $execID);
}
示例15: getData
/**
* Returns the memcache key value.
*
* @param string $key
* @return mixed
*/
protected function getData($key)
{
$diskcache = $this->getCachePaths($key);
$ret = false;
if (file_exists($diskcache["fullpath"])) {
if (filemtime($diskcache["fullpath"]) < $this->lifetime) {
Logger::Warn("Unlinking stale cachefile '" . $diskcache["fullpath"] . "'");
unlink($diskcache["fullpath"]);
} else {
$fp = fopen($diskcache["fullpath"], "r");
if (flock($fp, LOCK_SH)) {
//$cachedresult = file_get_contents($diskcache["fullpath"]);
$cachedresult = fread($fp, filesize($diskcache["fullpath"]));
flock($fp, LOCK_UN);
if (!empty($cachedresult)) {
Profiler::StartTimer("DataManager::Query() - load from cachefile");
Logger::Info("Loaded cached result for '%s' from file: '%s'", $key, $diskcache["fullpath"]);
$result = unserialize(gzdecode($cachedresult));
if ($result !== false) {
$ret = $result;
}
Profiler::StopTimer("DataManager::Query() - load from cachefile");
}
} else {
Logger::Error("Failed to get shared lock for '%s' (%s)", $key, $diskcache["fullpath"]);
}
}
}
return $ret;
}