本文整理汇总了PHP中Log::doLog方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::doLog方法的具体用法?PHP Log::doLog怎么用?PHP Log::doLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::doLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class Constructor
*
* @throws LogicException
*
*/
public function __construct()
{
if (empty($this->review_order_page)) {
throw new LogicException("Property 'review_order_page' can not be EMPTY");
}
if (empty($this->tokenName)) {
throw new LogicException("Property 'tokenName' can not be EMPTY");
}
//SESSION ENABLED
$this->sessionStart();
parent::__construct(false);
$filterArgs = array($this->tokenName => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), $this->dataKeyName => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
$__getInput = filter_input_array(INPUT_GET, $filterArgs);
/*
*
* Do something with Token ( send it for authentication on confirm )
*
* $__getInput['tk']
*
*/
$this->tokenAuth = $__getInput[$this->tokenName];
$this->data_key_content = $__getInput[$this->dataKeyName];
Log::doLog($_GET);
Log::doLog($_SERVER['QUERY_STRING']);
}
示例2: _TimeStampMsg
function _TimeStampMsg($msg, $log = true)
{
if ($log) {
Log::doLog($msg);
}
echo "[" . date(DATE_RFC822) . "] " . $msg . "\n";
}
示例3: doAction
public function doAction()
{
switch ($this->__postInput['exec']) {
case 'stayAnonymous':
unset($_SESSION['_anonym_pid']);
unset($_SESSION['incomingUrl']);
unset($_SESSION['_newProject']);
break;
case 'ping':
$db = Database::obtain();
$db->query("SELECT 1");
$this->result['data'] = array("OK", time());
break;
case 'checkTMKey':
//get MyMemory apiKey service
$tmxHandler = new TMSService();
$tmxHandler->setTmKey($this->__postInput['tm_key']);
//validate the key
try {
$keyExists = $tmxHandler->checkCorrectKey();
} catch (Exception $e) {
/* PROVIDED KEY IS NOT VALID OR WRONG, $keyExists IS NOT SET */
Log::doLog($e->getMessage());
}
if (!isset($keyExists) || $keyExists === false) {
$this->result['errors'][] = array("code" => -9, "message" => "TM key is not valid.");
Log::doLog(__METHOD__ . " -> TM key is not valid.");
$this->result['success'] = false;
} else {
$this->result['errors'] = array();
$this->result['success'] = true;
}
break;
}
}
示例4: uncompletedChunksByProjectId
static function uncompletedChunksByProjectId($id_project)
{
// for each project you can have several jobs, one per targert language.
// for each job you can have one or more chunks.
// jobs are identified by id_job and target language.
// chunks are identified by id_job and password.
//
// translations have a reference to job, not to the chunk.
// in order to associate the segment_translation to the chunk we need to
// refer to the start and stop segment stored on the job.
//
// I would be great if we could have a chunk identifier on the segment_translation.
// segments don't have a reference to the job neither, since they are linked to the file.
//
$query_most_recent_completion_events_for_chunk = " " . " SELECT * FROM ( " . " SELECT * FROM chunk_completion_events WHERE id_project = :id_project " . " ORDER BY create_date DESC ) t " . " GROUP BY id_project, id_job, password ";
// This query should return no records, meaning all submitted events have
// create_date greater than the chunk's latest translation date.
$query_for_event_submitted_at_least_once = "SELECT ch.id_job, ch.password " . " FROM segment_translations st INNER JOIN " . "( {$query_most_recent_completion_events_for_chunk} ) ch ON " . " st.id_segment BETWEEN ch.job_first_segment AND ch.job_last_segment " . " AND st.id_job = ch.id_job AND ch.id_project = :id_project " . " AND ch.create_date < st.translation_date";
// This query should return no records, meaning all jobs have at least one
// submitted chunk completion event.
$query_to_return_unsubmitted_chunks = "SELECT jobs.id as id_job, jobs.password " . " FROM jobs LEFT JOIN chunk_completion_events ch ON " . " jobs.id = ch.id_job AND " . " jobs.password = ch.password AND " . " jobs.job_first_segment = ch.job_first_segment AND " . " jobs.job_last_segment = ch.job_last_segment AND " . " jobs.id_project = ch.id_project " . " WHERE jobs.id_project = :id_project " . " AND ch.id IS NULL ";
$union_query = "SELECT * FROM ( {$query_to_return_unsubmitted_chunks} " . " UNION ALL {$query_for_event_submitted_at_least_once} ) t1 " . " GROUP BY id_job, password ";
$query_to_return_chunks = "SELECT * from jobs INNER JOIN ( {$union_query} ) filtered " . " ON jobs.id = filtered.id_job AND jobs.password = filtered.password ";
$conn = Database::obtain()->getConnection();
Log::doLog($query_to_return_chunks);
$stmt = $conn->prepare($query_to_return_chunks);
$stmt->execute(array('id_project' => $id_project));
$stmt->setFetchMode(PDO::FETCH_CLASS, 'Chunks_ChunkStruct');
return $stmt->fetchAll();
}
示例5: status
public function status()
{
// TODO: move this in to a json presenter class
$uncompleted = Projects_ProjectDao::uncompletedChunksByProjectId($this->request->id_project);
$is_completed = count($uncompleted) == 0;
$id_project = $this->request->id_project;
$response = array();
$response = array('id' => $id_project);
try {
if ($is_completed) {
$jobs = $this->validator->getProject()->getJobs();
$response['jobs'] = array();
foreach ($jobs as $job) {
$response['jobs'][] = array('id' => $job->id, 'password' => $job->password, 'download_url' => INIT::$HTTPHOST . "/?action=downloadFile" . "&id_job=" . $job->id . "&password=" . $job->password);
}
$response['completed'] = true;
} else {
$response['completed'] = false;
$response['chunks'] = array();
foreach ($uncompleted as $chunk) {
$response['chunks'][] = array('id' => $chunk->id, 'password' => $chunk->password);
}
}
$this->response->json(array('project_status' => $response));
} catch (Exception $e) {
Log::doLog($e->getMessage());
// TODO handle 500 response code here
}
}
示例6: finalize
/**
* Call the output in JSON format
*
*/
public function finalize()
{
$toJson = json_encode($this->result);
if (function_exists("json_last_error")) {
switch (json_last_error()) {
case JSON_ERROR_NONE:
// Log::doLog(' - No errors');
break;
case JSON_ERROR_DEPTH:
Log::doLog(' - Maximum stack depth exceeded');
break;
case JSON_ERROR_STATE_MISMATCH:
Log::doLog(' - Underflow or the modes mismatch');
break;
case JSON_ERROR_CTRL_CHAR:
Log::doLog(' - Unexpected control character found');
break;
case JSON_ERROR_SYNTAX:
Log::doLog(' - Syntax error, malformed JSON');
break;
case JSON_ERROR_UTF8:
Log::doLog(' - Malformed UTF-8 characters, possibly incorrectly encoded');
break;
default:
Log::doLog(' - Unknown error');
break;
}
}
echo $toJson;
}
示例7: doAction
/**
* When Called it perform the controller action to retrieve/manipulate data
*
* @return mixed
*/
function doAction()
{
if (count($this->errors) > 0) {
return null;
}
//get job language and data
//Fixed Bug: need a specific job, because we need The target Language
//Removed from within the foreach cycle, the job is always the same...
$jobData = $this->jobInfo = getJobData($this->jobID, $this->jobPass);
$pCheck = new AjaxPasswordCheck();
//check for Password correctness
if (empty($jobData) || !$pCheck->grantJobAccessByJobData($jobData, $this->jobPass)) {
$msg = "Error : wrong password provided for download \n\n " . var_export($_POST, true) . "\n";
Log::doLog($msg);
Utils::sendErrMailReport($msg);
return null;
}
$projectData = getProject($jobData['id_project']);
$source = $jobData['source'];
$target = $jobData['target'];
$tmsService = new TMSService();
/**
* @var $tmx SplTempFileObject
*/
$this->tmx = $tmsService->exportJobAsTMX($this->jobID, $this->jobPass, $source, $target);
$this->fileName = $projectData[0]['name'] . "-" . $this->jobID . ".tmx";
}
示例8: __construct
public function __construct() {
parent::__construct();
$filterArgs = array(
'id' => array( 'filter' => FILTER_SANITIZE_NUMBER_INT ),
'id_job' => array( 'filter' => FILTER_SANITIZE_NUMBER_INT ),
'src_content' => array( 'filter' => FILTER_UNSAFE_RAW ),
'trg_content' => array( 'filter' => FILTER_UNSAFE_RAW ),
'password' => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH ),
'token' => array( 'filter' => FILTER_SANITIZE_STRING,
'flags' => FILTER_FLAG_STRIP_LOW ),
'logs' => array( 'filter' => FILTER_UNSAFE_RAW),
'glossaryList' => array( 'filter' => FILTER_CALLBACK, 'options' => array('self','filterString') )
);
$this->__postInput = (object)filter_input_array( INPUT_POST, $filterArgs );
if( !empty( $this->__postInput->logs ) && $this->__postInput->logs != '[]' ){
Log::$fileName = 'clientLog.log';
Log::doLog( json_decode( $this->__postInput->logs ) );
Log::$fileName = 'log.txt';
}
}
示例9: _logMsg
/**
* @param $msg
*/
protected function _logMsg($msg)
{
// \INIT::$DEBUG = false;
if (\INIT::$DEBUG) {
echo "[" . date(DATE_RFC822) . "] " . $msg . "\n";
}
\Log::doLog($msg);
}
示例10: doAction
/**
* When Called it perform the controller action to retrieve/manipulate data
*
* @return mixed
*/
function doAction()
{
try {
$this->_checkData("auto_propagation.log");
} catch (Exception $e) {
if ($e->getCode() == -1) {
Utils::sendErrMailReport($e->getMessage());
}
Log::doLog($e->getMessage());
return $e->getCode();
}
$cookie_key = '_auto-propagation-' . $this->id_job . "-" . $this->password;
$boolString = (string) (int) $this->propagateAll;
$cookieLife = new DateTime();
$cookieLife->modify('+15 days');
$db = Database::obtain();
if ($this->propagateAll) {
$db->begin();
$old_translation = getCurrentTranslation($this->id_job, $this->id_segment);
//check tag mismatch
//get original source segment, first
$segment = getSegment($this->id_segment);
//compare segment-translation and get results
$check = new QA($segment['segment'], $this->translation);
$check->performConsistencyCheck();
if ($check->thereAreWarnings()) {
$err_json = $check->getWarningsJSON();
$translation = $this->translation;
} else {
$err_json = '';
$translation = $check->getTrgNormalized();
}
$TPropagation = array();
$TPropagation['id_job'] = $this->id_job;
$TPropagation['translation'] = $translation;
$TPropagation['status'] = Constants_TranslationStatus::STATUS_DRAFT;
$TPropagation['autopropagated_from'] = $this->id_segment;
$_Translation['serialized_errors_list'] = $err_json;
$TPropagation['warning'] = $check->thereAreWarnings();
$TPropagation['translation_date'] = date("Y-m-d H:i:s");
$TPropagation['segment_hash'] = $old_translation['segment_hash'];
try {
propagateTranslation($TPropagation, $this->jobData, $this->id_segment, true);
$db->commit();
} catch (Exception $e) {
$db->rollback();
$msg = $e->getMessage() . "\n\n" . $e->getTraceAsString();
Log::doLog($msg);
Utils::sendErrMailReport($msg);
}
}
setcookie($cookie_key, $boolString, $cookieLife->getTimestamp(), "/", $_SERVER['HTTP_HOST']);
Log::doLog("Auto-propagation for already translated segments on Job " . $this->id_job . " set to '" . var_export($this->propagateAll, true) . "'. Cookie Expire at " . $cookieLife->format('Y-m-d H:i:s'));
$this->result['errors'][] = array("code" => 0, "message" => "OK");
}
示例11: doAction
public function doAction()
{
if (empty($this->segment)) {
$this->result['errors'][] = array("code" => -1, "message" => "missing source segment");
}
if (empty($this->translation)) {
$this->result['errors'][] = array("code" => -2, "message" => "missing target translation");
}
if (empty($this->source_lang)) {
$this->result['errors'][] = array("code" => -3, "message" => "missing source lang");
}
if (empty($this->target_lang)) {
$this->result['errors'][] = array("code" => -4, "message" => "missing target lang");
}
if (empty($this->time_to_edit)) {
$this->result['errors'][] = array("code" => -5, "message" => "missing time to edit");
}
if (empty($this->id_segment)) {
$this->result['errors'][] = array("code" => -6, "message" => "missing segment id");
}
//get Job Infos, we need only a row of jobs ( split )
$job_data = getJobData((int) $this->id_job, $this->password);
$pCheck = new AjaxPasswordCheck();
//check for Password correctness
if (empty($job_data) || !$pCheck->grantJobAccessByJobData($job_data, $this->password)) {
$this->result['errors'][] = array("code" => -10, "message" => "wrong password");
$msg = "\n\n Error \n\n " . var_export(array_merge($this->result, $_POST), true);
Log::doLog($msg);
Utils::sendErrMailReport($msg);
return;
}
//mt engine to contribute to
if ($job_data['id_mt_engine'] <= 1) {
return false;
}
$this->mt = Engine::getInstance($job_data['id_mt_engine']);
//array of storicised suggestions for current segment
$this->suggestion_json_array = json_decode(getArrayOfSuggestionsJSON($this->id_segment), true);
//extra parameters
$extra = json_encode(array('id_segment' => $this->id_segment, 'suggestion_json_array' => $this->suggestion_json_array, 'chosen_suggestion_index' => $this->chosen_suggestion_index, 'time_to_edit' => $this->time_to_edit));
//send stuff
$config = $this->mt->getConfigStruct();
$config['segment'] = CatUtils::view2rawxliff($this->segment);
$config['translation'] = CatUtils::view2rawxliff($this->translation);
$config['source'] = $this->source_lang;
$config['target'] = $this->target_lang;
$config['email'] = INIT::$MYMEMORY_API_KEY;
$config['segid'] = $this->id_segment;
$config['extra'] = $extra;
$config['id_user'] = array("TESTKEY");
$outcome = $this->mt->set($config);
if ($outcome->error->code < 0) {
$this->result['errors'] = $outcome->error->get_as_array();
}
}
示例12: lastTranslationByJobOrChunk
public function lastTranslationByJobOrChunk($chunk)
{
$conn = Database::obtain()->getConnection();
$query = "SELECT * FROM segment_translations " . " WHERE id_job = :id_job " . " AND segment_translations.id_segment BETWEEN :job_first_segment AND :job_last_segment " . " ORDER BY translation_date DESC " . " LIMIT 1 ";
Log::doLog($query);
$stmt = $conn->prepare($query);
$array = array('id_job' => $chunk->id, 'job_first_segment' => $chunk->job_first_segment, 'job_last_segment' => $chunk->job_last_segment);
$stmt->execute($array);
$stmt->setFetchMode(PDO::FETCH_CLASS, 'Translations_SegmentTranslationStruct');
return $stmt->fetch();
}
示例13: thereIsAMisconfiguration
/**
*
* @return bool
*/
public static function thereIsAMisconfiguration()
{
try {
$redisHandler = new Predis\Client(INIT::$REDIS_SERVERS);
return INIT::$VOLUME_ANALYSIS_ENABLED && !Analysis_Manager::fastAnalysisIsRunning($redisHandler) && !Analysis_Manager::tmAnalysisIsRunning($redisHandler);
} catch (Exception $ex) {
$msg = "****** No REDIS instances found. ******";
Log::doLog($msg);
return false;
}
}
示例14: getThreadContributorUids
public function getThreadContributorUids($input)
{
$obj = $this->sanitize($input);
$query = "SELECT DISTINCT(uid) FROM " . self::TABLE . " WHERE id_job = {$obj->id_job} " . " AND id_segment = {$obj->id_segment} " . " AND uid IS NOT NULL ";
if ($input->uid) {
$query .= " AND uid <> {$obj->uid} ";
}
Log::doLog($query);
$this->con->query($query);
$arr_result = $this->_fetch_array($query);
return $arr_result;
}
示例15: __construct
public function __construct($response)
{
$this->responseData = isset($response['responseData']) ? $response['responseData'] : '';
$this->responseStatus = isset($response['responseStatus']) ? $response['responseStatus'] : '';
if ($this->responseStatus == 200 || $this->responseStatus == 202) {
if (!isset($this->responseData['tm'])) {
//TMX IMPORT STATUS CARRIES A LIST and not a single element, skip the id assignment
$this->id = $this->responseData['id'];
}
} else {
Log::doLog($response);
}
}