Socket
Socket
Sign inDemoInstall

@byu-oit/logger

Package Overview
Dependencies
45
Maintainers
13
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @byu-oit/logger

Default configuration for pino logger


Version published
Weekly downloads
840
increased by70.73%
Maintainers
13
Created
Weekly downloads
 

Readme

Source

BYU Logger

GitHub Release codecov

Creates a pino logger with default settings to match the CES Application Development logging standards.

It will pretty-print logs when run locally, but it will write logs in JSON when deployed (when NODE_ENV=production).

Install

npm i @byu-oit/logger 

Usage

import DefaultLogger from '@byu-oit/logger'

const logger = DefaultLogger()

logger.info('Hello World')
logger.warn('Something weird happened')
logger.error(new Error('Something went wrong!'))
CommonJS Equivalent

const { default: DefaultLogger } = require('@byu-oit/logger')

const logger = DefaultLogger()

logger.info('Hello World')
logger.warn('Something weird happened')
logger.error(new Error('Something went wrong!'))


The semantics are slightly different than functions like console.log() and console.error().

Namely,

console.error('Something went wrong in X:', new Error('the error'))

would be roughly equivalent to

logger.error(new Error('the error'), 'Something went wrong in X')

For more details, see the pino documentation here.

Options

Any pino options can be overridden, but for compliance with our logging standards, we recommend sticking to the defaults provided in this package.

Example of overwriting a default

import DefaultLogger from "./logger"

const logger = DefaultLogger({ level: 'trace' })

FAQs

Last updated on 11 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc