New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@panda/logger

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@panda/logger

A simple logging interface for NodeJS applications

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Panda Logger

Panda Logger is a simplified instance of Winston Logger that is primarily used for the Panda framework, but that can be implemented in virtually any project.

Installation

npm i @panda/logger

Setup

Code

const PandaLogger = require('@panda/logger')

// get the base logger
const logger = PandaLogger.getLogger()

// initialize a new logger
const logger = PandaLogger.getLogger('Foo')

// initialize a new logger with custom level and format
const logger = Logger.getLogger('Bar', { level: 'debug', format: 'json' })

Command Line Overrides

LOG_LEVEL=debug LOG_FORMAT=json node index

Usage

const PandaLogger = require('@panda/logger')
const logger = PandaLogger.getLogger('Foo')

logger.fatal(msg)
logger.error(msg)
logger.warn(msg)
logger.info(msg)
logger.http(msg)
logger.verbose(msg)
logger.debug(msg)
logger.silly(msg)

logger.success(msg)
logger.fail(msg)

Levels

  • fatal
  • error
  • warn
  • info
  • http
  • verbose
  • debug
  • silly

Formats

  • simple - generic output
  • json - JSON formatted output
  • basic - timestamp label level message output
  • standard - colorized development output
  • cli - pretty-print viewable output

Functions & Variables

  • logger.success(msg) (level: info)
  • logger.fail(msg) (level: info)
  • logger.testLevels() - tests output of all levels against current level
  • logger.levels - returns a list of all levels
  • logger.level - returns the current level for that logger
  • logger.format - returns the current format for that logger

Testing & Linting

Run Tests

npm test

Run Linter

# run linter
npm run lint

# run linter and fix any fixable issues
npm run lint:fix

ToDo

  • Allow formats to be dynamically added

Keywords

panda

FAQs

Package last updated on 03 Jul 2023

Did you know?

Socket

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