JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 141
  • Score
    100M100P100Q70810F
  • License ISC

Fancy Logging!

Package Exports

  • fancylog

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fancylog) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Fancy Log

Installation

If you're using Yarn: yarn add fancylog
If you're using NPM: npm install --save fancylog

Once installed, require the package with

const log = require('fancylog')

Usage

Call one of the following functions or shortcuts for different levels of warning.

Logging Level Main Method Alias
Info log.info log.i
Debug log.debug log.d
Error log.error log.e
Verbose log.verbose log.v
Warn log.warn log.w

Example Call

// Code
log.i('SOME TEXT HERE')

// Would Output:
// [INFO]    [01/01/1970 00:00:00] SOME TEXT HERE

File Output

FancyLog exposes a class called FancylogFile. You can use this to also output all logged messages to a file. If the file doesn't exist, it will be created.

Usage

// Require the module
const FancyLog = require('fancylog')
// Setup the class
const log = new FancyLog.FileLogger('/path/to/log.txt')

// From there, use the methods as normal from the variable 'log'
log.v('Example String')

// OUTPUT
// [VERBOSE] [01/01/1970 00:00:00] Example String
// This is also appended to /path/to/log.txt