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

Feat: add logging #21

Merged
merged 38 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fe0187d
add logging
KirillDogadin-std Mar 16, 2023
cc3845a
capitalize msg in logger
KirillDogadin-std Mar 16, 2023
561445e
prisma db logging
KirillDogadin-std Mar 16, 2023
1fabb55
adjust check for proper db log levels
KirillDogadin-std Mar 16, 2023
0277a0b
adjust readme with env var
KirillDogadin-std Mar 16, 2023
af86c86
log responses
KirillDogadin-std Mar 16, 2023
118c055
async
KirillDogadin-std Mar 16, 2023
d49b8bd
filter functionality
KirillDogadin-std Mar 16, 2023
1b63827
improve md files
KirillDogadin-std Mar 16, 2023
9d0442e
improve logging filter
KirillDogadin-std Mar 16, 2023
856ed6f
doc update
KirillDogadin-std Mar 16, 2023
9a4fe25
split code
KirillDogadin-std Mar 20, 2023
367532e
refactor logging
KirillDogadin-std Mar 21, 2023
12ca9d6
allow no args for child logger
KirillDogadin-std Mar 21, 2023
8bc37ee
integrate logger into apollo
KirillDogadin-std Mar 21, 2023
deeb411
unused deps
KirillDogadin-std Mar 21, 2023
0b97e87
readme adjust
KirillDogadin-std Mar 21, 2023
df042dc
debug command
KirillDogadin-std Mar 21, 2023
d41337b
type package
KirillDogadin-std Mar 21, 2023
3d484ec
lint
KirillDogadin-std Mar 21, 2023
e0a0352
lint
KirillDogadin-std Mar 21, 2023
690bd91
lint
KirillDogadin-std Mar 21, 2023
9c40e07
nits
KirillDogadin-std Mar 22, 2023
d33fb4a
Merge branch 'main' into add_logging
KirillDogadin-std Mar 22, 2023
3aa9dae
merge
KirillDogadin-std Mar 22, 2023
157f413
lint
KirillDogadin-std Mar 22, 2023
5c6a3ca
typecheck
KirillDogadin-std Mar 22, 2023
e2daa00
minor
KirillDogadin-std Mar 23, 2023
48c3264
lint
KirillDogadin-std Mar 23, 2023
2562aad
update readme
KirillDogadin-std Mar 23, 2023
e2d8fc0
make prisma log things via pino
KirillDogadin-std Mar 23, 2023
4e205e7
adjust types
KirillDogadin-std Mar 23, 2023
4caa41c
readme and minors
KirillDogadin-std Mar 23, 2023
e9fc986
Merge branch 'main' into add_logging
KirillDogadin-std Mar 27, 2023
76e73ed
tests added
KirillDogadin-std Mar 27, 2023
6cee018
added the comment with doc link
KirillDogadin-std Mar 27, 2023
58850a4
rm block for ending api
KirillDogadin-std Mar 28, 2023
47d6fdd
adjust tests
KirillDogadin-std Mar 28, 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
10 changes: 1 addition & 9 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@
],
"import/prefer-default-export": "off",
"no-console": [
"error",
{
"allow": [
"info",
"warn",
"trace",
"error"
]
}
"error"
]
}
}
Expand Down
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
valiafetisov marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
### Logger usage

The project uses `pino` logger. This logger should be used over `console` calls.

For usual in-file logging one should import the logger from the corresponding `logger.ts` module
and use it in accordance with [documentation](https://github.com/pinojs/pino/tree/master/docs).

In case of logging the processes that happen during http request handling it is also
possible to use the dedicated logger that is accessible via the `express` request object.

Here's a couple of examples:

1. Http logging

```typescript
// some resolver code above
resolve: (_parent, _args, ctx) => {
ctx.request.req.log.warn('dangerous');
});
},

```

2. Usual logger

```typescript
import logger from './logger'

logger.info('Earth is flat')
valiafetisov marked this conversation as resolved.
Show resolved Hide resolved
```
Loading