1. Go to this page and download the library: Download myoperator/centrallog library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
myoperator / centrallog example snippets
use \MyOperator\CentralLog;
CentralLog::configure('mylog.log'); //logs.log refers to log output file
use \MyOperator\CentralLog;
CentralLog::configure("mylog.log");
$log = CentralLog::getLogger('myLogger');
$log->log("Something");
//Or you can also provide the title
$log->withTitle("Making curl request")->log("curl response");
string $outputpath Output path of the log file
string $server Server on which the application is running. Ex- S6, API01
string $class Class name under which the logger is being used
string $pattern logger pattern as described in https://logging.apache.org/log4php/docs/layouts/pattern.html
string $maxsize Maximum size per log
mixed $message Item to be logged
string $uid The unique id of item. In case of sync script, this can be engine uid. (optional)
integer $acl The ACL to be used to log the item. (optional). Can be one of [1,2,4]
string $loglevel The loglevel to use for the log. defaults to `info`. (optional)
$logger->withTitle($title)->log($message, $uid, $acl);
//This is same as above
$logger->title($title)->log($message, $uid, $acl);