PMCORE-1335 ProcessMaker core should be use the native Laravel log mechanism.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use Bootstrap;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class TimerEvent
|
||||
{
|
||||
private $arrayFieldDefinition = array(
|
||||
@@ -1162,42 +1166,6 @@ class TimerEvent
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Syslog register the information in Monolog Class
|
||||
*
|
||||
* @param int $level DEBUG=100 INFO=200 NOTICE=250 WARNING=300 ERROR=400 CRITICAL=500
|
||||
* @param string $message
|
||||
* @param string $ipClient for Context information
|
||||
* @param string $action for Context information
|
||||
* @param string $timeZone for Context information
|
||||
* @param string $workspace for Context information
|
||||
* @param string $usrUid for Context information
|
||||
* @param string $proUid for Context information
|
||||
* @param string $tasUid for Context information
|
||||
* @param string $appUid for Context information
|
||||
* @param string $delIndex for Context information
|
||||
* @param string $stepUid for Context information
|
||||
* @param string $triUid for Context information
|
||||
* @param string $outDocUid for Context information
|
||||
* @param string $inpDocUid for Context information
|
||||
* @param string $url for Context information
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
private function syslog(
|
||||
$level,
|
||||
$message,
|
||||
$action='',
|
||||
$aContext = array()
|
||||
)
|
||||
{
|
||||
try {
|
||||
\Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, config("system.workspace"), 'processmaker.log');
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start/Continue case by Timer-Event
|
||||
*
|
||||
@@ -1237,12 +1205,9 @@ class TimerEvent
|
||||
,'timeZone' => $datetime
|
||||
,'workspace'=> $sysSys
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Start new cases'
|
||||
,'START-NEW-CASES'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'Start new cases';
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
|
||||
//Query
|
||||
$criteria = $this->getTimerEventCriteria();
|
||||
@@ -1399,12 +1364,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,"Case #$applicationNumber created"
|
||||
,'CREATED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Case #$applicationNumber created";
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
|
||||
//Derivate new case
|
||||
$result = $ws->derivateCase("", $applicationUid, 1);
|
||||
@@ -1428,12 +1390,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,"Case #$applicationNumber routed"
|
||||
,'ROUTED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Case #$applicationNumber routed";
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
} else {
|
||||
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
|
||||
|
||||
@@ -1451,12 +1410,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
500
|
||||
,"Failed case #$applicationNumber. " . $arrayResult["message"]
|
||||
,'ROUTED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Failed case #$applicationNumber. " . $arrayResult["message"];
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
} else {
|
||||
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
|
||||
@@ -1472,12 +1428,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
500
|
||||
,"Failed case #$applicationNumber. " . $arrayResult["message"]
|
||||
,'CREATED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Failed case #$applicationNumber. " . $arrayResult["message"];
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$flagRecord = true;
|
||||
@@ -1494,12 +1447,9 @@ class TimerEvent
|
||||
,'TimeZone' => $datetime
|
||||
,'workspace'=> $sysSys
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Not exists any record to start a new case'
|
||||
,'NO-RECORDS'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'Not exists any record to start a new case';
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$common->frontEndShow("END");
|
||||
@@ -1513,12 +1463,9 @@ class TimerEvent
|
||||
,'TimeZone' => $datetime
|
||||
,'workspace'=> $sysSys
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Start continue the cases'
|
||||
,'START-CONTINUE-CASES'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'Start continue the cases';
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
|
||||
//Query
|
||||
$criteriaMain = $this->getTimerEventCriteria();
|
||||
@@ -1708,12 +1655,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,"Case #$applicationNumber continued"
|
||||
,'CONTINUED-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Case #$applicationNumber continued";
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
} else {
|
||||
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
|
||||
|
||||
@@ -1730,12 +1674,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
500
|
||||
,"Failed case #$applicationUid. " . $arrayResult["message"]
|
||||
,'CONTINUED-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Failed case #$applicationUid. " . $arrayResult["message"];
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$flagRecord = true;
|
||||
@@ -1754,12 +1695,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Continue date '. $continueCaseDate
|
||||
,'INVALID-CONTINUE-DATE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'Invalid date to continue ' . $continueCaseDate;
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$counter++;
|
||||
@@ -1780,12 +1718,9 @@ class TimerEvent
|
||||
,'TimeZone' => $datetime
|
||||
,'workspace'=> $sysSys
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'No existing records to continue a case'
|
||||
,'NO-RECORDS'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'No existing records to continue a case';
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$common->frontEndShow("END");
|
||||
|
||||
Reference in New Issue
Block a user