1.0.5 • Published 2 years ago

simple-frontend-logger v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Simple-Frontend-Logger

Want to save logs during frontend web development in a file? Just use logger.log() and get logs in .log / .txt / .json format

Version npm

NPM

Usage

const logger = require('simple-frontend-logger');
logger.level = 2;
logger.fileFormat = 'JSON';

logger.log(0, "This is an error message");
logger.log(1, "This is a warn message");
logger.log(2, "This is an info message");
logger.log(3, "This is a debug message");

logger.error("This is an error message");
logger.warn("This is a warn message");
logger.info("This is an info message");
logger.debug("This is a debug message");

Logging

Logging levels in simple-frontend-logger is assumed to be numerically ascending from most important to least important._

const levels = {
  error: 0,
  warn: 1,
  info: 2,
  debug: 3
};

A logger has following member variables:

NameDefaultDescription
level3Log only if log level of message is less than or equal to this level
fileFormatSIMPLELogs are saved in .txt in simple format, LOG and JSON format are also available
_save_logs_keyqPress Ctrl+q to save logs on your machine
_console_logs_keybPress Ctrl+b to log all logs on your console
_clear_logs_keymPress Ctrl+m to clear all logs

A logger has following methods:

NameDescription
saveLogs()Downloads logs on your machine
consoleLogs()console.log() all logs
clearLogs()Clears all existing logs

Installation

npm install simple-frontend-logger
yarn add simple-frontend-logger

Author: Tejas Vaij

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago