本文整理汇总了PHP中Log::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::getInstance方法的具体用法?PHP Log::getInstance怎么用?PHP Log::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->session = Session::getInstance();
$this->user = User::getInstance();
$this->webDBUtils = WebDBUtils::getInstance();
$this->log = Log::getInstance();
}
示例2: read
/**
*
* Enter description here ...
* @param unknown_type $itemid
*/
public function read($itemid)
{
$db = Database::getInstance();
$log = Log::getInstance();
$sql = "SELECT link_type_item type," . "v_descr name,material," . "price_unit,price_paq price_pack,price_box," . "stock_min,link_marca trademark,image " . "FROM " . TBL_ITEM . " WHERE id={$itemid}";
$res = $db->query($sql);
if (!$res) {
$log->addError("No se puedo obtener datos de Producto.");
return false;
}
if ($db->rows($res) != 1) {
$log->addError("No se encontraron datos de Producto solicitado.");
$db->dispose($res);
return false;
}
$row = $db->getRow($res);
$this->id = $itemid;
$this->name = $row['name'];
$this->type = $row['type'];
$this->stockMin = $row['stock_min'];
$this->trademark = $row['trademark'];
$this->priceUnit = $row['price_unit'];
$this->priceBox = $row['price_box'];
$this->pricePack = $row['price_pack'];
$this->material = $row['material'];
return true;
}
示例3: execute
public function execute($sql, $params = array())
{
$startTime = microtime(true);
$this->affectRowCount = 0;
$stmt = $this->conn->prepare($sql);
if ($stmt) {
if ($params) {
foreach ($params as $k => &$param) {
$stmt->bindParam($k, $param, PDO::PARAM_STR, strlen($param));
}
}
} else {
return false;
}
$res = $stmt->execute();
$endTime = microtime(true);
$execTime = round($endTime - $startTime, 3);
if ($this->longtime && $execTime > $this->longtime) {
Log::getInstance('LongTime')->write(json_encode(array('sql' => $sql, 'params' => $params, 'runTime' => $execTime)));
}
if (!$res) {
$error = $stmt->errorInfo();
if (isset($error[2]) && $error[2]) {
Log::getInstance('DBerror')->write(json_encode(array('sql' => $sql, 'params' => $params, 'error' => $error[2])));
}
}
$this->affectRowCount = $res ? $stmt->rowCount() : 0;
return $stmt;
}
示例4: __construct
public function __construct()
{
$this->session = Session::getInstance();
$this->log = Log::getInstance();
$this->loadEmbedSettings();
$this->procUtils = ProcUtils::getInstance();
}
示例5: read
/**
*
* Enter description here ...
* @param unknown_type $lotid
*/
public function read($lotid)
{
$db = Database::getInstance();
$log = Log::getInstance();
$sql = "SELECT itemid,cajas,unidades,stock,active,idalmacen,costo,tran_mar,tran_ter,aduana,trans_bank,otros,price_final,obs FROM " . TBL_LOT . " WHERE id={$lotid}";
$res = $db->query($sql);
if (!$res) {
$log->addError("No se pudo recuperar información de Lote.");
return false;
}
if ($db->rows($res) != 1) {
$log->addError("Lote solicitado no existe.");
$db->dispose($res);
return false;
}
$row = $db->getRow($res);
$this->id = $lotid;
$this->itemid = $row['itemid'];
$this->boxes = $row['cajas'];
$this->units = $row['unidades'];
$this->active = $row['active'];
$this->storeid = $row['idalmacen'];
$this->cost = $row['costo'];
$this->costMar = $row['tran_mar'];
$this->costTer = $row['tran_ter'];
$this->costAdu = $row['aduana'];
$this->costBank = $row['trans_bank'];
$this->price = $row['price_final'];
$this->stock = $row['stock'];
$this->gloss = $row['obs'];
$db->dispose($res);
return true;
}
示例6: user_edit
function user_edit()
{
$log = Log::getInstance();
$user = new User();
$storeid = isset($_POST['store']) ? $_POST['store'] : 0;
$user->id = isset($_POST['user']) ? $_POST['user'] : "";
$user->firstname = isset($_POST['firstname']) ? $_POST['firstname'] : "";
$user->lastname = isset($_POST['lastname']) ? $_POST['lastname'] : "";
$user->username = isset($_POST['username']) ? $_POST['username'] : "";
$user->password = isset($_POST['passwd']) ? $_POST['passwd'] : "";
$user->ci = isset($_POST['ci']) ? $_POST['ci'] : "";
$user->active = isset($_POST['active']);
$user->level = isset($_POST['role']) ? $_POST['role'] : 0;
$user->address = isset($_POST['address']) ? $_POST['address'] : "";
$user->phone = isset($_POST['phone']) ? $_POST['phone'] : "";
$user->email = isset($_POST['email']) ? $_POST['email'] : "";
if ($user->update()) {
if ($_FILES['upload']['name']) {
$imagepath = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']) . "img/user/\${$user->id}.jpg";
if (move_uploaded_file($_FILES['upload']['tmp_name'], $imagepath)) {
$user->imagepath = $imagepath;
$user->update();
} else {
$log->addError("No fue posible subir imagen");
}
}
} else {
$log->addError("No fue posible actualizar usuario, verifique que Usuario sea único.");
}
}
示例7: __construct
public function __construct($item)
{
if (empty($item)) {
return $item;
}
$dbConf = Conf::getConf('/db/mysql/' . $item);
$this->log = Log::getInstance('mysql');
$this->connect($dbConf["hostname"], $dbConf["username"], $dbConf["password"], $dbConf["database"], $dbConf["pconnect"]);
}
示例8: executeDeleteContact
public function executeDeleteContact()
{
$data = array("contacts_id" => $_REQUEST["cid"]);
if ($this->model->delete($data)) {
Log::getInstance()->insert(array("action" => "delete", "module" => "contacts", "title" => "Suppression d'un contact", "message" => "Un contact a été supprimé avec succès"));
} else {
echo json_encode(array("alert" => "Une erreur est survenue pendant la suppression d'un contact"));
}
}
示例9: nativQuery
/**
* Does nativ query(MySQL)
* Returns PDO result
* @param string $query
* @return queryResult
*/
public function nativQuery($query)
{
//Log::getInstance()->event($query,Log::INFO);
try {
return $this->pdo->query($query);
} catch (PDOException $e) {
Log::getInstance()->event($e->getMessage(), Log::ERROR);
}
}
示例10: fire
public static function fire($event, $args = array())
{
if (isset(self::$events[$event])) {
foreach (self::$events[$event] as $func) {
call_user_func($func, $args);
}
}
$Log = Log::getInstance();
$Log->NewLog($event);
}
示例11: getLogger
public function getLogger($obj = null)
{
if (!self::$logger) {
self::$logger = Log::getInstance();
}
if ($obj instanceof DB_DataObject) {
return self::returnStatus(self::$logger);
}
return self::$logger;
}
示例12: __construct
public function __construct()
{
$this->session = Session::getInstance();
$this->log = Log::getInstance();
$this->user = User::getInstance();
$this->storage = Storage::getInstance();
$this->webDBUtils = WebDBUtils::getInstance();
$this->dpUtils = DataProviderUtils::getInstance();
$this->screen = false;
$this->availableFeatures = false;
}
示例13: __construct
/**
* constructor
*
* @param string $type tipo de datamanager a ser incializado
*
* inicializa o objeto de log e de bd
* inicializa o vetor de dados nulo de acordo com o tipo
*/
function __construct($type)
{
$this->db = MysqliDb::getInstance();
$this->log = Log::getInstance();
//tipo de dado valido pra iniciar
if (array_key_exists($type, $this->_validFields)) {
$this->type = $type;
foreach ($this->_validFields[$this->type] as $key => $value) {
$this->setField($key, null);
}
}
}
示例14: update
/**
*
* Enter description here ...
*/
public function update()
{
$log = Log::getInstance();
$db = Database::getInstance();
$this->setupSafeInput();
$sql = "UPDATE " . TBL_CUSTOMER . " SET " . "name='{$this->name}'," . "address='{$this->address}'," . "phone='{$this->phone}'," . "cell='{$this->cell}'," . "nit='{$this->nit}'," . "active={$this->active}," . "email='{$this->email}'," . "date_modified=NOW() " . "WHERE id={$this->id}";
if (!$db->query($sql)) {
$log->addError("No se pudo actualizar datos de Cliente.");
return false;
}
return true;
}
示例15: add
public function add()
{
$db = Database::getInstance();
$log = Log::getInstance();
$this->setupSafeInput();
$sql = "INSERT INTO " . TBL_DEPARTMENT . "(name," . "contact_name," . "phone," . "active," . "address," . "fax," . "email," . "description) " . " VALUES " . "('" . $db->escape($this->name) . "'," . "'" . $db->escape($this->contact) . "'," . "'" . $db->escape($this->phone) . "'," . "{$this->active}," . "'" . $db->escape($this->address) . "'," . "'" . $db->escape($this->fax) . "'," . "'" . $db->escape($this->email) . "'," . "'" . $db->escape($this->description) . "')";
$res = $db->query($sql);
if (!$res) {
$log->addError("No se pudo agregar datos.");
} else {
$this->id = $db->lastID();
}
return $res;
}