-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Hi,
I just got around to test the new cool SlackWebhookHandler. It works nice and fixes problems I had before, there is however one annoyance I found. @an1zhegorodov I didn't want to continue discussion in your original PR though.
I use attachments and include context and extra data. Depending on the length of the context, it's either formatted well or cut:
Looking good:
$nestedArray = [];
for ($i = 0; $i < 27; $i++) {
$nestedArray["foo $i"] = str_repeat($i, $i * 2);
}
$context = ['nested' => $nestedArray];
$this->logger->warning('Warning test', $context);
the whole nested array is displayed in code block (using "```").
If I, however, make it bigger:
$nestedArray = [];
for ($i = 0; $i < 30; $i++) {
$nestedArray["foo $i"] = str_repeat($i, $i * 2);
}
$context = ['nested' => $nestedArray];
$this->logger->warning('Warning test', $context);
The context output is truncated and the whole code block is broken. Below, it's how it looks like at the beginning of the msg (I don't include full msg cause it's big):
You can see at the beginning that there is no closing "```" of code block (probably because truncation). I don't have time to debug this now, it could be as well a limitation of Slack Webhook formatting.
What I'm trying to do:
I want to include a stacktrace (not based on exception) in a context so that it's prettified and displayed in code block on Slack. The NormalizerFormatter
and "stringification" get the job done, but only for small contexts.