In Laravel 5.6 I'm trying to make proper slack logs and I did:
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single', 'slack'],
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'TEST',
'icon' => ':boom:',
'level' => 'info',
],
It works but I want to specify additional fields and maybe customize it a little if it match some other conditions.
I was looking at SlackWebhookHandler.php monolog file but not all parameters work in this configuration.. For example emoji and username doesn't work - I don't know if slack already has even options for changing bot username. Other example is that in this file something it's called useAttachment and here it's just attachment - where the names are stored..?
Back to topic I did:
Log::info('added test',['test'=>'test']);
And it works, but for slack I want to send additional field, in every request for example:
'added test',['test'=>'test', 'more' => 'test2']
How I'm able to accomplish it? I need to connect to Log Class and slack driver in some way but I don't have idea how to do this?