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


PHP Logs类代码示例

本文整理汇总了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));
 }
开发者ID:Telemedellin,项目名称:puntos,代码行数:25,代码来源:ContenidoController.php

示例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', 'ออกจากระบบสำเร็จ');
     }
 }
开发者ID:nattaphat,项目名称:cuse2,代码行数:25,代码来源:AuthController.php

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

示例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);
 }
开发者ID:bersace,项目名称:strass,代码行数:10,代码来源:Logger.php

示例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;
 }
开发者ID:urichalex,项目名称:CS-Bans,代码行数:10,代码来源:Syslog.php

示例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();
 }
开发者ID:azizbekvahidov,项目名称:foods,代码行数:11,代码来源:ProductsController.php

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

示例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');
 }
开发者ID:nattaphat,项目名称:cuse2,代码行数:14,代码来源:ReportController.php

示例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);
     }
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:20,代码来源:LogsController.php

示例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;
 }
开发者ID:jilgue,项目名称:ownWebAppServices,代码行数:31,代码来源:CoreScript.php

示例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";
 }
开发者ID:KWinston,项目名称:EPLProject,代码行数:25,代码来源:KitTypesController.php

示例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;
     });
 }
开发者ID:KWinston,项目名称:EPLProject,代码行数:28,代码来源:Kits.php

示例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;
     });
 }
开发者ID:KWinston,项目名称:EPLProject,代码行数:28,代码来源:KitContents.php

示例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");
 }
开发者ID:cunwang,项目名称:msgque-resque,代码行数:30,代码来源:AbsJobs.php

示例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;
     });
 }
开发者ID:KWinston,项目名称:EPLProject,代码行数:32,代码来源:BookingDetails.php


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