3.8.4 • Published 1 year ago

@reatom/logger v3.8.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Tiny logger with a couple nice configurations.

included in @reatom/framework

Usage

All atoms and actions with names or without underscore in the name logs automatically

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

if (import.meta.env.DEV) {
  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.8.4

1 year ago

3.8.3

1 year ago

3.8.2

1 year ago

3.8.1

1 year ago

3.8.0

1 year ago

3.6.1

1 year ago

3.4.4

2 years ago

3.4.3

2 years ago

3.6.0

2 years ago

3.5.0

2 years ago

3.4.5

2 years ago

3.4.1

2 years ago

3.4.0

2 years ago

3.3.1

2 years ago

3.3.0

2 years ago

3.2.0

2 years ago

3.1.9

2 years ago

3.1.3

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.1.5

3 years ago

3.1.4

3 years ago

3.1.8

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago