3.6.1 • Published 14 days ago

@reatom/logger v3.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

Tiny logger with a couple nice configurations.

included in @reatom/framework

Usage

All atoms and actions with names or without underscore logs automatically

import { connectLogger, createLogBatched } from '@reatom/logger'

connectLogger(ctx)

// OR

connectLogger(
  ctx,
  // optional configuration
  {
    // the length of the atom history (patches) to store
    history: 10,
    // `false` by default to made your logs short
    showCause: false,
    // `true` by default to made your logs clear
    skipUnnamed: true,
    // fine tuning :)
    skip: (patch: AtomCache) => false,
    // `createLogBatched` by default to not spam you a lot
    // you could pass regular `console.log` here
    log: createLogBatched(
      // optional configuration
      {
        // 500ms by default
        debounce: 500,
        // 5000ms by default, it helps to not stuck with WS and so on
        limit: 5000,
        // `toLocaleTimeString` by default
        getTimeStamp: () => new Date().toLocaleTimeString()

        log: console.log,
        // `true` by default to group logs by name
        shouldGroup: true,
      },
    ),
    // You could customize a logs group: `Reatom ${domain}N transactions`
    domain: '',
  },
)

Every log record includes a number in the start of the name to fix autosorting keys in a console.

Here is how it looks like (from this example):

3.6.1

14 days ago

3.4.4

9 months ago

3.4.3

10 months ago

3.6.0

7 months ago

3.5.0

8 months ago

3.4.5

9 months ago

3.4.1

1 year ago

3.4.0

1 year ago

3.3.1

1 year ago

3.3.0

1 year ago

3.2.0

1 year ago

3.1.9

1 year ago

3.1.3

1 year ago

3.1.2

1 year ago

3.1.1

1 year ago

3.1.0

2 years ago

3.1.5

1 year ago

3.1.4

1 year ago

3.1.8

1 year ago

3.0.1

2 years ago

3.0.0

2 years ago