@seek/logger
Advanced tools
Comparing version 4.4.6 to 4.4.7
{ | ||
"author": { | ||
"name": "Discover" | ||
"name": "SEEK" | ||
}, | ||
@@ -53,3 +53,3 @@ "bugs": { | ||
}, | ||
"sideEffects": "false", | ||
"sideEffects": false, | ||
"skuba": { | ||
@@ -62,3 +62,3 @@ "entryPoint": "src/index.ts", | ||
"types": "./lib-types/index.d.ts", | ||
"version": "4.4.6" | ||
"version": "4.4.7" | ||
} |
@@ -56,2 +56,4 @@ # @seek/logger | ||
Bearer tokens are redacted regardless of their placement in the log object. | ||
For suggestions on enforcing logged object structures for consistency, see [below](#enforcing-logged-object-structures). | ||
@@ -61,3 +63,3 @@ | ||
- All log structures deeper than 4 levels will be omitted from output. | ||
- All log structures deeper than 4 levels (default) will be omitted from output. | ||
- All log structures (objects/arrays) with size bigger/longer than 64 will be trimmed. | ||
@@ -67,16 +69,13 @@ - All strings that are longer than 512 will be trimmed. | ||
All Bearer tokens (regardless of their placement in the log object) will be redacted by the logger itself. | ||
Avoid logging complex structures such as buffers, deeply nested objects and long arrays. | ||
Trimming operations are not cheap and may lead to significant performance issues of your application. | ||
As trimming operations are not cheap please make sure your application logs only meaningful data which does not contain | ||
Buffers, deeply nested objects, large arrays or other large entities, because it might lead to significant performance issues of your application. | ||
While log depth is configurable via `loggerOptions.maxObjectDepth`, we strongly discourage a log depth that exceeds the default of 4 levels. | ||
Consider flattening the log structure for performance, readability and cost savings. | ||
Note: You could configure the depth of the logs using the `loggerOptions.maxObjectDepth`, however we strongly do not recommend | ||
logging deeper than 4 levels (default setting) as it might cause performance issues for your app as well costs implications. | ||
Consider flattening the log structure and make it as meaningful as possible instead. | ||
### Pino | ||
## Pino | ||
**@seek/logger** uses Pino under the hood. | ||
You can customise your logger by providing [Pino options] like so: | ||
Library is utilising [Pino](https://github.com/pinojs/pino/blob/master/docs/api.md#options). | ||
If you would like to customise your logging you could do so by providing options acceptable by pino while creating a logger like so: | ||
```javascript | ||
@@ -96,4 +95,24 @@ import createLogger, { pino } from '@seek/logger'; | ||
Note: createLogger mutates the supplied destination in order to redact sensitive data. | ||
Note: `createLogger` mutates the supplied destination in order to redact sensitive data. | ||
### Pretty printing | ||
**@seek/logger** supports Pino-compatible pretty printers. | ||
For example, you can install **[pino-pretty]** as a `devDependency`: | ||
```shell | ||
yarn add --dev pino-pretty | ||
``` | ||
Then selectively enable pretty printing when running your application locally: | ||
```typescript | ||
import createLogger from '@seek/logger'; | ||
const logger = createLogger({ | ||
name: 'my-app', | ||
prettyPrint: process.env.ENVIRONMENT === 'local', | ||
}); | ||
``` | ||
## Serializers | ||
@@ -108,1 +127,4 @@ | ||
Compatibility should be maintained with the existing [`serializer functions`](src/serializers/index.ts). | ||
[pino options]: https://github.com/pinojs/pino/blob/master/docs/api.md#options | ||
[pino-pretty]: https://github.com/pinojs/pino-pretty |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24991
126