2.1.0 • Published 9 months ago

@loglayer/plugin-sprintf v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Sprintf Plugin for LogLayer

NPM Version NPM Downloads TypeScript

The sprintf plugin for loglayer provides printf-style string formatting support using sprintf-js.

It allows you to format your log messages using familiar printf-style placeholders if a transport does not support this behavior.

Disclaimer

  • LogLayer does not allow passing items that are not strings, booleans, or numbers into message methods like info, error, etc, and would recommend that only string / boolean / number specifiers be used.

Installation

npm install @loglayer/plugin-sprintf

Usage

import { LogLayer, ConsoleTransport } from 'loglayer'
import { sprintfPlugin } from '@loglayer/plugin-sprintf'

const log = new LogLayer({
  transport: new ConsoleTransport({
    logger: console
  }),
  plugins: [
    sprintfPlugin()
  ]
})

// Example usage
log.info("Hello %s!", "world")
// Output: Hello world!

log.info("Number: %d", 42)
// Output: Number: 42

Documentation

For more details, visit https://loglayer.dev/plugins/sprintf

2.1.0

9 months ago

2.0.4

12 months ago

2.0.3

12 months ago

2.0.2

12 months ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago