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

Add Foal logger and request ID #1234

Merged
merged 37 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
30cd86b
[Docs] Fix component name
LoicPoullain Oct 17, 2023
43d47c9
Add Foal logger
LoicPoullain Oct 18, 2023
5fc71a0
Remove incorrect console.log
LoicPoullain Oct 18, 2023
4178692
Rename err to error
LoicPoullain Oct 18, 2023
9d3e72f
Remove useless try/catch
LoicPoullain Oct 18, 2023
5ed1203
Remove unused variable
LoicPoullain Oct 18, 2023
0f0a02c
Use Foal logger when an error is thrown in HTTP controller
LoicPoullain Oct 18, 2023
5f5c609
Use Foal logger when an error is thrown in WS controller
LoicPoullain Oct 18, 2023
40c7f23
Use Foal logger when a stream error is thrown
LoicPoullain Oct 18, 2023
fcf298f
[CLI] Configure Foal logger for different environments
LoicPoullain Oct 18, 2023
5d797ca
Use Foal logger in examples
LoicPoullain Oct 18, 2023
d5b4076
[CLI] Fix template
LoicPoullain Oct 18, 2023
158170d
Move formatMessage to logger.utils
LoicPoullain Oct 18, 2023
28aa931
Update Node types
LoicPoullain Oct 19, 2023
164ced0
Add shouldLog util
LoicPoullain Oct 19, 2023
48c6a2a
Add log level config in Logger
LoicPoullain Oct 19, 2023
9c3ceb9
Support http pretty logging in Foal logger
LoicPoullain Oct 19, 2023
c32b437
Allow to log HTTP requests with Foal logger
LoicPoullain Oct 19, 2023
a3e31f2
Do not log query params
LoicPoullain Oct 20, 2023
dbba1b8
Fix linting
LoicPoullain Oct 20, 2023
10490b8
[CLI] Use Foal logger for HTTP requests
LoicPoullain Oct 20, 2023
b7cc767
[CLI] Rever config file changes
LoicPoullain Oct 20, 2023
f096bd4
Pretty display error in @foal/examples
LoicPoullain Oct 20, 2023
1599a9b
Mark @Log as deprecated
LoicPoullain Oct 21, 2023
00baeca
Add random ID on each request
LoicPoullain Oct 21, 2023
0a82607
Add Logger.log
LoicPoullain Oct 21, 2023
0ca1b30
Allow to add context to Logger
LoicPoullain Oct 21, 2023
39e63e6
Add request ID to log context
LoicPoullain Oct 21, 2023
7b8bf3c
Add user ID to log context for sessions
LoicPoullain Oct 21, 2023
0b809dd
Add user ID to log context for JWT
LoicPoullain Oct 21, 2023
3780837
Make use of mocks consistent
LoicPoullain Oct 21, 2023
6a9f068
Allow to customize logged morgan params
LoicPoullain Oct 22, 2023
da08345
Fix test on locale time
LoicPoullain Oct 22, 2023
1fe6358
Fix test to support latest version of Node 20
LoicPoullain Oct 22, 2023
931aa97
Allow to add transport
LoicPoullain Oct 22, 2023
44d3219
[Docs] Add docs on logging
LoicPoullain Oct 23, 2023
40ab005
[Blog] Add v4.1 release notes
LoicPoullain Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/blog/assets/version-4.1-is-here/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions docs/blog/version-4.1-release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Version 4.1 release notes
author: Loïc Poullain
author_title: Creator of FoalTS. Software engineer.
author_url: https://loicpoullain.com
author_image_url: https://avatars1.githubusercontent.com/u/13604533?v=4
image: blog/twitter-banners/version-4.1-release-notes.png
tags: [release]
---

![Banner](./assets/version-4.1-is-here/banner.png)

Version 4.1 of [Foal](https://foalts.org/) is out!

<!--truncate-->

## Better logging

Foal now features a true logging system. Full documentation can be found [here](../docs/common/logging).

### New recommended configuration

It is recommended to switch to this configuration to take full advantage of the new logging system.

*config/default.json*
```json
{
"settings": {
"loggerFormat": "foal"
}
}
```

*config/development.json*
```json
{
"settings": {
"logger": {
"format": "dev"
}
}
}
```

## Request IDs

On each request, a request ID is now generated randomly. It can be read through `ctx.request.id`.

If the `X-Request-ID` header exists in the request, then the header value is used as the request identifier.
Binary file added docs/docs/common/images/dev-format.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/common/images/json-format.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/common/images/raw-format.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading