axe 10.0.0 → 10.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
6
6
  [![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://github.com/lassjs/lass)
7
7
  [![license](https://img.shields.io/github/license/cabinjs/axe.svg)](LICENSE)
8
+ [![npm downloads](https://img.shields.io/npm/dt/axe.svg)](https://npm.im/axe)
8
9
 
9
10
  > Axe is a logger-agnostic wrapper that normalizes logs regardless of argument style. Great for large development teams, old and new projects, and works with Pino, Bunyan, Winston, console, and more. It is lightweight, performant, highly-configurable, and automatically adds OS, CPU, and Git information to your logs. It supports hooks (useful for masking sensitive data) and dot-notation remapping, omitting, and picking of log metadata properties. Made for [Forward Email][forward-email], [Lad][], and [Cabin][].
10
11
 
@@ -33,6 +34,7 @@
33
34
  * [Examples](#examples)
34
35
  * [Send Logs to HTTP Endpoint](#send-logs-to-http-endpoint)
35
36
  * [Send Logs to Slack](#send-logs-to-slack)
37
+ * [Send Logs to Sentry](#send-logs-to-sentry)
36
38
  * [Suppress Logger Data](#suppress-logger-data)
37
39
  * [Contributors](#contributors)
38
40
  * [License](#license)
@@ -401,7 +403,7 @@ See [Browser](#browser-1) usage below for more information.
401
403
  | ----------------------- | ----------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - |
402
404
  | `showStack` | Boolean | `true` | Attempts to parse a boolean value from `process.env.AXE_SHOW_STACK`). **If this value is `true`, then if `message` is an instance of an Error, it will be invoked as the first argument to logger methods. If this is `false`, then only the `err.message` will be invoked as the first argument to logger methods.** Basically if `true` it will call `logger.method(err)` and if `false` it will call `logger.method(err.message)`. If you pass `err` as the first argument to a logger method, then it will show the stack trace via `err.stack` typically. | |
403
405
  | `meta` | Object | See below | Stores all meta config information (see the following nested properties below). | |
404
- | `meta.show` | Boolean | `true` | Attempts to parse a boolean value from `process.env.AXE_SHOW_META` – meaning you can pass a flag `SHOW_META=true node app.js` when needed for debugging), whether or not to output metadata to logger methods. If set to `false`, then fields will not be omitted nor picked; the entire meta object will be hidden from logger output. | |
406
+ | `meta.show` | Boolean | `true` | Attempts to parse a boolean value from `process.env.AXE_SHOW_META` – meaning you can pass a flag `AXE_SHOW_META=true node app.js` when needed for debugging), whether or not to output metadata to logger methods. If set to `false`, then fields will not be omitted nor picked; the entire meta object will be hidden from logger output. | |
405
407
  | `meta.remappedFields` | Object | `{}` | Attempts to parse an Object mapping from `process.env.AXE_REMAPPED_META_FIELDS` (`,` and `:` delimited, e.g. `REMAPPED_META_FIELDS=foo:bar,beep.boop:beepBoop` to remap `meta.foo` to `meta.bar` and `meta.beep.boop` to `meta.beepBoop`). Note that this will clean up empty objects by default unless you set the option `meta.cleanupRemapping` to `false`). Supports dot-notation. | |
406
408
  | `meta.omittedFields` | Array | `['level','err','app', 'args']` | Attempts to parse an array value from `process.env.AXE_OMIT_META_FIELDS` (`,` delimited) - meaning you can pass a flag `OMIT_META_FIELDS=user,id node app.js`), determining which fields to omit in the metadata passed to logger methods. Supports dot-notation. | |
407
409
  | `meta.pickedFields` | Array | `[]` | Attempts to parse an array value from `process.env.AXE_PICK_META_FIELDS` (`,` delimited) - meaning you can pass a flag, e.g. `PICK_META_FIELDS=request.headers,response.headers node app.js` which would pick from `meta.request` and `meta.response` *only* `meta.request.headers` and `meta.response.headers`), **This takes precedence after fields are omitted, which means this acts as a whitelist.** Supports dot-notation. | |
@@ -423,37 +425,35 @@ See [Browser](#browser-1) usage below for more information.
423
425
  ```
424
426
 
425
427
  ```sh
426
- and_chr 102
427
- and_ff 101
428
- and_qq 10.4
429
- and_uc 12.12
430
- android 101
431
- chrome 103
432
- chrome 102
433
- chrome 101
434
- chrome 100
435
- edge 103
436
- edge 102
437
- edge 101
438
- firefox 101
439
- firefox 100
440
- firefox 91
428
+ and_chr 107
429
+ and_ff 106
430
+ and_qq 13.1
431
+ and_uc 13.4
432
+ android 107
433
+ chrome 107
434
+ chrome 106
435
+ chrome 105
436
+ edge 107
437
+ edge 106
438
+ edge 105
439
+ firefox 106
440
+ firefox 105
441
+ firefox 102
442
+ ios_saf 16.1
443
+ ios_saf 16.0
444
+ ios_saf 15.6
441
445
  ios_saf 15.5
442
- ios_saf 15.4
443
- ios_saf 15.2-15.3
444
- ios_saf 15.0-15.1
445
446
  ios_saf 14.5-14.8
446
- ios_saf 14.0-14.4
447
- ios_saf 12.2-12.5
448
447
  kaios 2.5
449
448
  op_mini all
450
449
  op_mob 64
451
- opera 86
452
- opera 85
453
- safari 15.5
454
- safari 15.4
450
+ opera 91
451
+ opera 90
452
+ safari 16.1
453
+ safari 16.0
454
+ safari 15.6
455
+ samsung 18.0
455
456
  samsung 17.0
456
- samsung 16.0
457
457
  ```
458
458
 
459
459
  ### Node
@@ -844,7 +844,7 @@ This is an example of using hooks to send a message to Slack with logs of the "f
844
844
 
845
845
  // create an instance of the Slack Web Client API for posting messages
846
846
  const web = new WebClient('INSERT-YOUR-TOKEN', {
847
- // <https://slack.dev/node-slack-sdk/web-api#logging>
847
+ // https://slack.dev/node-slack-sdk/web-api#logging
848
848
  logger,
849
849
  logLevel: logger.config.level
850
850
  });
@@ -911,6 +911,42 @@ This is an example of using hooks to send a message to Slack with logs of the "f
911
911
  logger.error(new Error('Uh oh something went wrong!'));
912
912
  ```
913
913
 
914
+ ### Send Logs to Sentry
915
+
916
+ See below example and the reference at <https://docs.sentry.io/platforms/node/> for more information.
917
+
918
+ ```sh
919
+ npm install @sentry/node
920
+ ```
921
+
922
+ ```js
923
+ const Axe = require('axe');
924
+ const Sentry = require('@sentry/node');
925
+
926
+ const logger = new Axe();
927
+
928
+ Sentry.init({
929
+ // TODO: input your DSN here from Sentry once you're logged in at:
930
+ // https://docs.sentry.io/platforms/node/#configure
931
+ dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
932
+ });
933
+
934
+ for (const level of logger.config.levels) {
935
+ logger.post(level, (next, message, meta) => {
936
+ // https://docs.sentry.io/clients/node/usage/
937
+ if (message instanceof Error) {
938
+ Sentry.captureException(message, meta);
939
+ } else {
940
+ Sentry.captureMessage(message, meta);
941
+ }
942
+ next();
943
+ });
944
+ }
945
+
946
+ // do stuff
947
+ logger.error(new Error('uh oh'));
948
+ ```
949
+
914
950
  ### Suppress Logger Data
915
951
 
916
952
  This is an example of using a custom hook to manipulate logger arguments to suppress sensitive data.