forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1# Logger
2
3Simple logger for Bluesky.
4
5## At a Glance
6
7```typescript
8import { logger, Logger } from '#/logger'
9
10// or, optionally create new instance with custom context
11// const logger = Logger.create(Logger.Context.Notifications)
12
13// for dev-only logs
14logger.debug(message, {})
15
16// for production breadcrumbs
17logger.info(message, {})
18
19// seldom used, prefer `info`
20logger.log(message, {})
21
22// for non-error issues to look into, seldom used, prefer `error`
23logger.warn(message, {})
24
25// for known errors without an exception, use a string
26logger.error(`known error`, {})
27
28// for unknown exceptions
29try {
30} catch (e) {
31 logger.error(e, {message: `explain error`}])
32}
33```
34
35#### Log Levels
36
37Log level defaults to `info`. You can set this via the `EXPO_PUBLIC_LOG_LEVEL`
38env var in `.env.local`.
39
40#### Filtering debugs by context
41
42Debug logs are dev-only, and not enabled by default. Once enabled, they can get
43noisy. So you can filter them by setting the `EXPO_PUBLIC_LOG_DEBUG` env var
44e.g. `EXPO_PUBLIC_LOG_DEBUG=notifications`. These values can be comma-separated
45and include wildcards.