nginx / njs-acme

Nginx NJS module runtime to work with ACME providers like Let's Encrypt for automated no-reload TLS certificate issue/renewal.
Apache License 2.0
66 stars 11 forks source link

Logging Utility Class #6

Closed zsteinkamp closed 1 year ago

zsteinkamp commented 1 year ago

Problem

Log entries generated by this code are not easily discernible from other log entries. Using a log prefix requires the developer to include the prefix in each log event entry.

Proposed Solution

A utility method/class that wraps logging and adds a consistent log entry prefix.

From @ryepup:

nit/future: might be worth a tiny leveled logging wrapper to ensure we always have the acme-njs: [$MODULE] prefix and control verbosity.

import {Logger} from './logger'
const log = new Logger("utils")
...
log.info(`Generated a new account key and saved it to ${path}`)
ryepup commented 1 year ago

You can assign this to me, I sketched it up this morning so will put in a PR after #5