public function showList($request, $response) { /*{{{*/ $key = $request->key; $model = $request->model; $logList = LogClient::getInstance()->getlogList($key, $model); $response->logList = $logList; }
public function after($context) { $oldData = $context->response->oldData; $newData = $context->response->newData; $action = $context->action; $session = SessionDefault::singleton(); //用来记录点评审核修改内容, if (!empty($oldData) && $newData != 'delete' && $newData != 'recover' && $newData != "back" && $newData != "content_audit_pass" && $newData != "content_audit_refuse") { $indexs = array_keys($oldData); $tab = $indexs[0]; unset($newData['summary']); unset($newData['ver']); $model = "Hdf_" . $tab; $id = $oldData[$tab]['id']; $data = array(); foreach ($newData as $key => $value) { if (isset($oldData[$tab][$key]) && $value != $oldData[$tab][$key]) { $data['from'][$key] = $oldData[$tab][$key]; $data['to'][$key] = $value; } else { $data['from'][$key] = ""; $data['to'][$key] = $value; } } LogClient::getInstance()->addLog($session->UserId, $session->UserName, $model, $id, $action, $data); } //用来记录点评操作记录 if (!empty($oldData) && ($newData == 'delete' || $newData == 'recover' || $newData == 'back' || $newData == "content_audit_pass" || $newData == "content_audit_refuse")) { $indexs = array_keys($oldData); $tab = $indexs[0]; $ids = $context->response->ids; $model = "Hdf_" . $tab; foreach ($ids as $id) { LogClient::getInstance()->addLog($session->UserId, $session->UserName, $model, $id, $newData, array()); } } }
public function Post() { $client = new LogClient($this->_logKey, $this->_apiKey); $client->Post($this->Event); return $this; }
<?php require_once 'loggr.php'; // creating class for using fluent syntax $loggr = new Loggr("myfirstlog", "db961642e48e48e4ab00ef60c90fa29e"); // create a simple event $loggr->Events->Create()->Text("Simple fluent event")->Post(); // more complex event $world = "World"; $loggr->Events->Create()->TextF("hello%s", $world)->Tags("tag1 tag2 tag3")->Link("http://google.com")->Source("dave")->Data("foobar")->Value(3)->Geo(-14.456, 73.6879)->Post(); // trace a variable $var = "TEST VAR"; $loggr->Events->CreateFromVariable($var)->Text("Tracing TEST VAR")->Post(); // trace an exception try { $error = 'Always throw this error'; throw new Exception($error); } catch (Exception $e) { $loggr->Events->CreateFromException($e)->Text("Exception")->Post(); } // alternatively you can use a non-fluent syntax $client = new LogClient("myfirstlog", "db961642e48e48e4ab00ef60c90fa29e"); // create a simple event $ev = new Event(); $ev->Text = "Simple non-fluent event"; $client->Post($ev);