Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All template wrap tag and length more 4096 #36

Open
i3bepb opened this issue Mar 1, 2023 · 3 comments
Open

All template wrap tag and length more 4096 #36

i3bepb opened this issue Mar 1, 2023 · 3 comments

Comments

@i3bepb
Copy link
Contributor

i3bepb commented Mar 1, 2023

If error message length over 4096 and i change template:

<b>{{ $appName }}</b> ({{ $level_name }})
Env: {{ $appEnv }}
<pre>[{{ $datetime->format('Y-m-d H:i:s') }}] {{ $appEnv }}.{{ $level_name }} {{ $formatted }}</pre>

Message break and I get two messages:

<b>Project</b> (ERROR)
Env: local
<pre>[2023-03-01 17:41:32] local.ERROR many text

and:

many text</pre>

When send messages to telegram as a response we get 400 error:

{
  "ok": false,
  "error_code": 400,
  "description": "Bad Request: can't parse entities: Can't find end tag corresponding to start tag pre"
}

If not use wrap tag everything is fine.

Addition

I want 1 error = 1 message even if the size is over 4096. Example cut off and add ...

<b>Project</b> (ERROR)
Env: local
[2023-03-01 17:41:32] local.ERROR bla-bla-bla ...
@grkamil
Copy link
Owner

grkamil commented Mar 1, 2023

Maybe you can cut $formatted message in the template if you need?

@i3bepb
Copy link
Contributor Author

i3bepb commented Mar 1, 2023

Maybe you can cut $formatted message in the template if you need?

Yes

Is it planned to do something like this?

@i3bepb
Copy link
Contributor Author

i3bepb commented Mar 2, 2023

I decided to make a package https://github.com/i3bepb/laravel-crop-str-blade-directive with a directive for Blade that cuts the variable to the right size. With it, you can do this:

<b>{{ $appName }}</b> ({{ $level_name }})
Env: {{ $appEnv }}
<pre>[{{ $datetime->format('Y-m-d H:i:s') }}] {{ $appEnv }}.{{ $level_name }} @crop($formatted, 3846) }}</pre>

For others parts message I reserve 250 (4096 - 250 = 3846)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants