本文整理汇总了PHP中Logs类的典型用法代码示例。如果您正苦于以下问题:PHP Logs类的具体用法?PHP Logs怎么用?PHP Logs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Logs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView($id)
{
if (!empty($id)) {
$contenido = Contenido::model()->findByPk($id);
}
if (isset($_POST['Contenido'])) {
$contenido->texto = $_POST['Contenido']['texto'];
$log = new Logs();
try {
$log->accion = 'Edito el contenido de ' . $contenido->nombre . ' como admin';
$log->usuario = Yii::app()->user->id;
$log->msg = 'IP: ' . $_SERVER['REMOTE_ADDR'] . ' : ' . $_SERVER['REMOTE_PORT'];
$log->fecha = date('Y-m-d G:i:s');
$log->save();
} catch (Exception $e) {
$log->accion = 'Error log';
$log->msg = '';
$log->fecha = '';
$log->save();
}
$contenido->save('update');
}
// render - 1. vista 2. array con los objetos de tipo CActiveReord
$this->render('form', array('model' => $contenido));
}
示例2: logoutAction
public function logoutAction()
{
// Log out
if (Auth::User()) {
$user = new Usernhc();
$user_id = Auth::User()->id;
$user_info = $user->getUsernhcById($user_id);
$logs = new Logs();
$logs->ip = Request::getClientIp();
$logs->host = Request::root();
$logs->lastpage = '';
$logs->last_visit = date('Y-m-d H:i:s');
$logs->role_id = $user_info[0]->role_id;
$logs->data_id = rand(1, 11);
$logs->userid = $user_id;
$logs->save();
}
// Redirect to homepage
if (Auth::logout()) {
Auth::logout();
return Redirect::to('login')->with('success', 'ออกจากระบบสำเร็จ');
} else {
return Redirect::to('login')->with('success', 'ออกจากระบบสำเร็จ');
}
}
示例3: eventAction
function eventAction()
{
$t = new Logs();
$this->view->event = $event = $t->findOne($this->_getParam('id'));
$this->metas(array('DC.Title' => 'Évènement'));
$this->branche->append("Journal système", array('action' => 'log', 'id' => null));
$this->branche->append();
}
示例4: log
function log($level, $message, $url = null, $detail = null)
{
$user = Zend_Registry::get('user');
if (!$url) {
$url = $_SERVER['REQUEST_URI'];
}
$data = array('logger' => $this->name, 'level' => $level, 'user' => $user->id, 'message' => $message, 'url' => $url, 'detail' => substr(serialize($detail), 0, 4096));
$t = new Logs();
return $t->insert($data);
}
示例5: add
public static function add($action, $desc)
{
$log = new Logs();
$log->action = CHtml::encode($action);
$log->remarks = CHtml::encode($desc);
if ($log->save()) {
return TRUE;
}
return FALSE;
}
示例6: logs
private function logs($action, $tbName, $ID, $message)
{
$dates = $dates = date('Y-m-d H:i:s');
$modelss = new Logs();
$modelss->log_date = $dates;
$modelss->actions = $action;
$modelss->table_name = $tbName;
$modelss->curId = $ID;
$modelss->message = $message;
$modelss->save();
}
示例7: guarda_Cache
function guarda_Cache(Cache $cacheArquivo, Contatos $contatos, Logs $logs)
{
$resultado["contatos"] = $contatos->buscaContatos($_SESSION["usuarioID"]);
while ($data = mysqli_fetch_assoc($resultado["contatos"])) {
$dados["contatos"][] = $data;
}
$resultado["logs"] = $logs->buscaLog($_SESSION["usuarioID"]);
while ($data = mysqli_fetch_assoc($resultado["logs"])) {
$dados["logs"][] = $data;
}
$valor = json_encode($dados);
$cacheArquivo->set_valor($_SESSION["usuarioID"], $valor);
}
示例8: logsReport
public function logsReport($type, $startdt, $enddt)
{
$per_page = Config::get('nhc/site.ole_perpage');
$logs = new Logs();
$rs = $logs->getReportExport($type, $startdt, $enddt);
$this->result_log_report = $rs;
// return View::make('report.search')->with('paginator',$this->result_log_report);
// var_dump($this->result_log_report);
Excel::create('New file', function ($excel) {
$excel->sheet('New sheet', function ($sheet) {
$sheet->loadView('report.search_export')->with('paginator', $this->result_log_report);
});
})->download('csv');
}
示例9: actionCreate
/**
* Creates a new model.
* @return create view
*/
public function actionCreate()
{
// create Logs object model
$model = new Logs();
// if Logs form exist
if (isset($_POST['Logs'])) {
// set form elements to Logs model attributes
$model->attributes = $_POST['Logs'];
// find module_name before save
$module = Modules::model()->find(array('condition' => 't.module_name = :module_name', 'params' => array(':module_name' => $model->module_id)));
// set finded module_id to module->module_id
$model->module_id = $module->module_id;
// save without validate
$model->save(false);
}
}
示例10: _getFormatParams
private function _getFormatParams($params)
{
$ret = array();
foreach ($params as $param) {
// Si llegamos a un params que es un array es cosa del constructor de Object, paramos
if (is_array($param)) {
break;
}
if (preg_match("/^--(.+)\$/", $param, $match)) {
$ret[$match[1]] = true;
} else {
// Comprobamos que lo primero que llega no es un valor
if (count($ret) == 0) {
Logs::stFatal("mal muy mal");
}
// Si es el primer valor lo guardamos normal
if (is_bool($ret[end(array_keys($ret))])) {
$ret[end(array_keys($ret))] = $param;
} else {
if (is_array($ret[end(array_keys($ret))])) {
// Si ya es un array juntamos
$ret[end(array_keys($ret))] = array_merge($ret[end(array_keys($ret))], array($param));
} else {
// Si hay mas de uno lo guardamos como array
$ret[end(array_keys($ret))] = array_merge(array($ret[end(array_keys($ret))]), array($param));
}
}
}
}
return $ret;
}
示例11: destroy
public function destroy($kitTypeID)
{
// This Shall be fun!
// We have to deconstruct the types based on the forign key dependencys
// First iterate all the kits, for each kit remove all contents,
// and then all bookings (and all booking details)
// then finally we can remove the kit type and then all the logs for that
// kit type.
foreach (Kits::where('KitType', '=', $kitTypeID)->get() as $kit) {
foreach (KitContents::where("KitID", '=', $kit->ID)->get() as $content) {
KitContents::destroy($content->ID);
}
foreach (Booking::where("KitID", '=', $kit->ID)->get() as $booking) {
foreach (BookingDetails::where("BookingID", '=', $booking->ID)->get() as $detail) {
BookingDetails::destroy($detail->ID);
}
Booking::destroy($booking->ID);
}
Kits::destroy($kit->ID);
}
KitTypes::destroy($kitTypeID);
// Do the logs last, as all the deletes will log the changes of deleting the bits.
Logs::where('LogKey1', '=', $kitTypeID)->delete();
return "OK";
}
示例12: boot
public static function boot()
{
parent::boot();
static::created(function ($record) {
$kitTypeID = $record->KitType;
$kitID = $record->ID;
Logs::LogMsg(4, $kitTypeID, $kitID, null, "Created Kit: " . $record->Name);
return true;
});
static::updating(function ($record) {
$kitTypeID = $record->KitType;
$kitID = $record->ID;
$dirty = $record->getDirty();
foreach ($dirty as $field => $newdata) {
$olddata = $record->getOriginal($field);
if ($olddata != $newdata) {
Logs::LogMsg(5, $kitTypeID, $kitID, null, "Changed Kit field: " . $field . " From:" . $olddata . " To:" . $newdata);
}
}
return true;
});
static::deleting(function ($record) {
$kitTypeID = $record->KitType;
$kitID = $record->ID;
Logs::LogMsg(6, $kitTypeID, $kitID, null, "Deleted Kit: " . $record->Name);
return true;
});
}
示例13: boot
public static function boot()
{
parent::boot();
static::created(function ($record) {
$kitTypeID = $record->kit->KitType;
$kitID = $record->kit->ID;
Logs::LogMsg(10, $kitTypeID, $kitID, $record->ID, "Added content: " . $record->Name);
return true;
});
static::updating(function ($record) {
$kitTypeID = $record->kit->KitType;
$kitID = $record->kit->ID;
$dirty = $record->getDirty();
foreach ($dirty as $field => $newdata) {
$olddata = $record->getOriginal($field);
if ($olddata != $newdata) {
Logs::LogMsg(11, $kitTypeID, $kitID, $record->ID, "Changed " . $field . " From:" . $olddata . " To:" . $newdata);
}
}
return true;
});
static::deleting(function ($record) {
$kitTypeID = $record->kit->KitType;
$kitID = $record->kit->ID;
Logs::LogMsg(12, $kitTypeID, $kitID, $record->ID, "Removed Contents: " . $record->Name);
return true;
});
}
示例14: tearDown
public function tearDown()
{
$classArr = array_slice(explode('\\', static::getClassName()), -1, 1);
$className = $classArr[0];
$data = Tools::encoding($this->args, "utf-8", "gbk");
/**
* @ 此步可以记录队列总共、每天、每月、每年处理的数量
* @ 2015/12/15 added
*/
# $redis = "";
# $key = "{$className}:nums";
# $dayKey = "{$className}:".date('Ymd')."nums";
# $monthKey = "{$className}:".date('Ym')."nums";
# $yearKey = "{$className}:".date('Y')."nums";
#
# try {
# $redis->incr($key);
# $redis->incr($dayKey);
# $redis->incr($monthKey);
# $redis->incr($yearKey);
# } catch(RedisException $e) {
# Logs::logit(date('Y-m-d H:i:s')."\t".$e->getMessage(), "error".date('Ymd').".log");
# }
#
/**
* 日志记录每条数据操作,后期可添加Cron定期清理
*/
Logs::logit(date('Y-m-d H:i:s') . "\t" . $key . " inc 1");
Logs::logit(date('Y-m-d H:i:s') . "\n" . var_export($data['array'], true), $className . date('Ymd') . ".log");
}
示例15: boot
public static function boot()
{
parent::boot();
static::created(function ($record) {
$userName = "";
if (isset($record->UserID)) {
$userName = User::find($record->UserID)->username;
} else {
$userName = $record->Email;
}
$primaryBooker = " as primary booker";
if (!$record->Booker) {
$primaryBooker = " as secondary contact";
}
Logs::LogMsg(18, $record->booking->kit->KitType, $record->booking->kit->ID, $record->booking->branch->ID, "Added user:" . $userName . $primaryBooker);
return true;
});
static::updating(function ($record) {
$dirty = $record->getDirty();
foreach ($dirty as $field => $newdata) {
$olddata = $record->getOriginal($field);
if ($olddata != $newdata) {
Logs::LogMsg(19, $record->booking->kit->KitType, $record->booking->kit->ID, $record->booking->branch->ID, $field . " changed From:" . $olddata . " To:" . $newdata);
}
}
return true;
});
static::deleting(function ($record) {
Logs::LogMsg(20, $record->booking->kit->KitType, $record->booking->kit->ID, $record->booking->branch->ID, "Detail deleted by:" . Auth::user()->username);
return true;
});
}