PHP code example of protounit / watchtower

1. Go to this page and download the library: Download protounit/watchtower 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/ */

    

protounit / watchtower example snippets


$config = [
	'botId'     => 'BOTID:BOTID',
	'channelId' => 'CHANNELID',
	'timeZone'  => 'Europe/Rome',
	'useFork    => true
];


Monolog\Logger;
use Protounit\WatchTower\TelegramHandler;

/**
* Minimal imeZone'  => 'Europe/Rome',
];

/**
* Creating Logger interface with custom channel name
*/
$logger = new Logger('WatchTower');

/**
* Including custom handler for Monolog messages
*/
$logger->pushHandler(new TelegramHandler($config));

/**
* Example messages
*/
$logger->error(
	'An error occurred while creating another better example',
	[
	    'file'      => __FILE__,
	    'line'      => __LINE__,
	    'debugInfo' => [
		'message' => 'Yet another message',
	    ],
	]
);

/**
* Something more interesting
*/
$logger->critical(
'Cannot allocate memory: couldn\'t create child process',
	[
	    'file'      => __FILE__,
	    'line'      => __LINE__,
	    'debugInfo' => [
		'memory' => '640K',
	    ],
	]
);