本文整理汇总了PHP中logMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP logMessage函数的具体用法?PHP logMessage怎么用?PHP logMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: core
/**
*
* @param string $name
* @param bool $instance
* @return object|null Object or NULL
* @throws Exception
*/
public static function core($name, $instance = TRUE)
{
$core_name = ucfirst($name);
if (!class_exists($core_name)) {
try {
$path = APP_DIR . '/core/' . $core_name . '.php';
if (file_exists($path)) {
require $path;
if ($instance === TRUE) {
$exclude_instance = array('View', 'Layout');
if (in_array($core_name, $exclude_instance)) {
return NULL;
}
$instance_name = $core_name == 'Database' ? 'DB' : $core_name;
return new $instance_name();
}
} else {
throw new Exception('Core not found: ' . $core_name);
}
} catch (Exception $e) {
logMessage('error', $e->getMessage(), TRUE);
showError($e->getMessage(), 'Error: Loader', 500);
}
}
return NULL;
}
示例2: sendReport
private function sendReport($get_parameters, $post_parameters)
{
if (extension_loaded("curl")) {
// create a new cURL resource
$ch = curl_init();
$url = INSTALL_REPORT_URL . '?' . http_build_query($get_parameters);
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
//curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_parameters);
// grab URL and pass it to the browser
$result = curl_exec($ch);
if (!$result) {
logMessage(L_ERROR, 'Failed sending install report ' . curl_error($ch));
} else {
logMessage(L_INFO, 'Sending install report');
}
// close cURL resource, and free up system resources
curl_close($ch);
}
}
示例3: startSQLSession
function startSQLSession()
{
global $globalLink;
if (!empty($globalLink)) {
return $globalLink;
}
$link = mysql_connect(HOST, USER, PASSWORD);
if ($link) {
$db_selected = mysql_select_db(DATABASE, $link);
if (!$db_selected) {
logMessage(__FUNCTION__ . " - IMPOSSIBLE DE SE CONNECTER A LA DATABASE", LOG_LEVEL_ERROR);
}
} else {
logMessage(__FUNCTION__ . " - IMPOSSIBLE DE SE CONNECTER AU SERVEUR SQL : " . mysql_error(), LOG_LEVEL_ERROR);
////////////////////////////////////////////////////////////////
sleep(10);
$link = mysql_connect(HOST, USER, PASSWORD);
if ($link) {
$db_selected = mysql_select_db(DATABASE, $link);
if (!$db_selected) {
logMessage(__FUNCTION__ . " - IMPOSSIBLE DE SE CONNECTER A LA DATABASE", LOG_LEVEL_ERROR);
}
}
////////////////////////////////////////////////////////////////
}
$globalLink = $link;
return $link;
}
示例4: update
public function update()
{
// validation check
if (!is_null($this->desirePercent)) {
if ($this->desirePercent > 100.0) {
$this->desirePercent = 100.0;
}
if ($this->desirePercent < 0.0) {
$this->desirePercent = 0.0;
}
$this->desirePercent = round($this->desirePercent);
}
// now onto the update
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("UPDATE shiftpreference SET desirePercent = ? " . " WHERE workerid = ? AND jobid = ?");
$stmt->execute(array($this->desirePercent, $this->workerid, $this->jobid));
$dbh->commit();
return $this;
} catch (PDOException $pe) {
logMessage('ShiftPreference::update()', $pe->getMessage());
throw $pe;
}
}
示例5: logWorkerListState
public function logWorkerListState($message, $note)
{
logMessage($message, $note);
foreach ($this->workerList as $worker) {
$worker->logState($message);
}
}
示例6: test
public function test($value, $expected, $testName)
{
if ($value != $expected) {
failed("{$testName} - Expected '{$expected}', Got: '{$value}'");
} else {
logMessage(" Passed: {$testName} - value '{$value}'");
}
}
示例7: executeRCommand
function executeRCommand($rInstanceScreenName, $command, $markInstanceAsAvailable = 1)
{
if ($markInstanceAsAvailable == 1) {
$command = $command . "mark.as.available();";
}
$cmd = 'screen -L -S ' . $rInstanceScreenName . ' -p 0 -X stuff "' . $command . "\n" . '"';
logMessage(" - " . $command);
shell_exec($cmd);
}
示例8: send
/**
* used both internally, and to send any arbitrary mail.
* See notes on WorkerViewPage
*/
public static function send($to, $subject, $body)
{
try {
$headers = 'From: support@consked.com' . "\r\n" . 'Reply-To: support@consked.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $body, $headers);
} catch (Exception $ex) {
logMessage('FormMail.send(' . $to . ')', $ex->getMessage());
}
}
示例9: addJob
public function addJob(JobSchedule $job, $expoId, $override = FALSE)
{
if (array_key_exists($job->jobid, $this->jobList)) {
return;
}
// already added
if (!$override) {
$expo = Expo::selectID($expoId);
$preference = $this->jobPreferences[$job->jobid];
if (is_null($preference->desirePercent)) {
$job->subWorker($this, $expoId, TRUE);
// we may have added it
throw new ScheduleImpossibleException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid);
}
$newJobMinutes = $this->jobMinutes + $job->jobMinutes();
if ($newJobMinutes > $this->maxMinutes) {
$job->subWorker($this, $expoId, TRUE);
// we may have added it
throw new ScheduleOverMaxHoursException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid . " as will have total minutes above max:" . ($newJobMinutes - $this->maxMinutes));
}
if ($newJobMinutes > 60 * $expo->expoHourCeiling) {
$job->subWorker($this, $expoId, TRUE);
// we may have added it
throw new ScheduleOverMaxHoursException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid . " as will have total minutes above expo max:" . ($newJobMinutes - 60 * $expo->expoHourCeiling));
}
foreach ($this->jobList as $existing) {
if ($job->isTimeConflict($existing)) {
if ($expo->allowScheduleTimeConflict) {
logMessage("WorkerSchedule", "overlapping conflict allowed");
if ($job->isStartTimeConflict($existing)) {
$job->subWorker($this, $expoId, TRUE);
// we may have added it
$sce = new ScheduleConflictException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid . " due to identical start time conflict with existing Job:" . $existing->jobid);
$sce->conflict = $existing;
logMessage("WorkerSchedule", $sce);
throw $sce;
}
} else {
$job->subWorker($this, $expoId, TRUE);
// we may have added it
$sce = new ScheduleConflictException("Worker:" . $this->workerid . " cannot work in Job:" . $job->jobid . " due to conflict with existing Job:" . $existing->jobid);
$sce->conflict = $existing;
logMessage("WorkerSchedule", $sce);
throw $sce;
}
// allowScheduleTimeConflict
}
}
// $existing
}
// $override
$this->jobList[$job->jobid] = $job;
$this->jobMinutes += $job->jobMinutes();
$job->addWorker($this, $expoId, $override);
// must be at very end
return;
}
示例10: addHistory
function addHistory($idMember, $type, $filename = "")
{
$createdDate = getCurrentDateSQLFormat();
$sqlQuery = "INSERT INTO qcs_history (idMember, createdDate , type , filename) VALUES('" . $idMember . "' , '" . $createdDate . "' , '" . $type . "' , '" . $filename . "'" . ")";
// echo $sqlQuery . "<br/>";
logMessage(__FUNCTION__ . " - " . $sqlQuery, LOG_LEVEL_DEBUG);
$sqlLink = startSQLSession();
$result = mysql_query($sqlQuery);
closeSQLSession($sqlLink);
}
示例11: assignWorker
public function assignWorker(WorkerSchedule $worker, $expoId)
{
if (0 == count($this->jobList)) {
return;
}
// jobs in preference order
$myJobList = $worker->sortJobPreference($this->jobList, FALSE);
// first get locations in preference order
$locations = array();
foreach ($myJobList as $job) {
if (!in_array($job->location, $locations)) {
$locations[] = $job->location;
}
}
// $job
// next reorder jobs ... order by preference group by location!
$groupByLocation = array();
foreach ($locations as $location) {
foreach ($myJobList as $job) {
if (0 == strcmp($job->location, $location)) {
$groupByLocation[] = $job;
}
}
// $job
}
// $location
$myJobList = NULL;
$locations = NULL;
$lockLocation = NULL;
logMessage("LocationLock", "assigning workerid:" . $worker->workerid . " count(gbl):" . count($groupByLocation));
foreach ($groupByLocation as $job) {
try {
logMessage("LocationLock - isnull?", "jobid:" . $job->jobid . " in try ");
if (!is_null($lockLocation)) {
logMessage("LocationLock - strcmp", "lockLocation:" . $lockLocation . " after is_null " . $job->location);
if (0 != strcmp($lockLocation, $job->location)) {
logMessage("LocationLock - break", "jobid:" . $job->jobid . " lockLocation:" . $lockLocation . " before break ");
break;
// leave loop
}
}
logMessage("LocationLock - addwprler", "jobid:" . $job->jobid . " worker:" . $worker->workerid);
$job->addWorker($worker, $expoId);
// exception leaves $lockLocation NULL
logMessage("LocationLock - set lockLocation", "job->location:" . $job->location);
$lockLocation = $job->location;
} catch (ScheduleException $se) {
logMessage("LocationLock failure", $job->jobid . " " . $se->getMessage());
continue;
// do not force
}
}
// $job
$groupByLocation = NULL;
}
示例12: groupInfo
function groupInfo($key)
{
global $debug;
$result = rest("get_group_profile", "group={$key}");
if ($result == null) {
logMessage('sl', 0, "Error retrieving group profile for {$key}", null, null);
return null;
}
$xml = new SimpleXMLElement($result);
return $xml->groupprofile->name . "," . $xml->groupprofile->insignia . "," . $xml->groupprofile->maturepublish . "," . $xml->groupprofile->charter;
}
示例13: select
private static function select($sql, $params)
{
try {
$rows = simpleSelect("ShiftAssignmentView", $sql, $params);
foreach ($rows as $row) {
$row->fixDates();
}
return $rows;
} catch (PDOException $pe) {
logMessage('ShiftAssignmentView::select(' . $sql . ', ' . var_export($params, true) . ')', $pe->getMessage());
}
}
示例14: dbConnect
function dbConnect()
{
$dbserver = "localhost";
$dbuser = "naboor";
$dbpass = "naboor";
$dbname = "naboor";
$myDB = new mysqli($dbserver, $dbuser, $dbpass, $dbname);
if ($myDB->connect_errno > 0) {
logMessage("Connection failed on DB " . $dbname);
}
return $myDB;
}
示例15: update
public function update()
{
try {
$dbh = getPDOConnection();
$dbh->beginTransaction();
$stmt = $dbh->prepare("UPDATE jobpreference SET job1 = ?, job2 = ?, job3 = ?, job4 = ?, job5 = ?, job6 = ?, job7 = ?, job8 = ?, job9 = ?, job10 = ?, " . "job11 = ?, job12 = ?, job13 = ?, job14 = ?, job15 = ?, job16 = ?, job17 = ?, job18 = ?, job19 = ?, job20 = ? " . "WHERE workerid = ?");
$stmt->execute(array($this->job1, $this->job2, $this->job3, $this->job4, $this->job5, $this->job6, $this->job7, $this->job8, $this->job9, $this->job10, $this->job11, $this->job12, $this->job13, $this->job14, $this->job15, $this->job16, $this->job17, $this->job18, $this->job19, $this->job20, $this->workerid));
$dbh->commit();
return $this;
} catch (PDOException $pe) {
logMessage('JobPreference::update()', $pe->getMessage());
}
}