0.1.1 • Published 3 years ago

loggerjs-web v0.1.1

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
3 years ago

loggerjs-web

Ultrafast logger for modern web | simple | lightweight | 0 dependency. Currently, built for frameworks which use process.env variable system at runtime. At present default log level is set to debug in code like:

export const CURRENT_LOG_LEVEL = process.env.CURRENT_LOG_LEVEL || LogLevel.DEBUG;

If using yarn:

yarn add loggerjs-web

If using npm:

npm install loggerjs-web

To use in code:

  • Override CURRENT_LOG_LEVEL variable in your build tool environment.

E.g. in React as:

CURRENT_LOG_LEVEL=info yarn start

or

CURRENT_LOG_LEVEL=info npm start if you are using npm.

Currently supported log levels:

export enum LogLevel {
  DEBUG = 'debug',
  INFO = 'info',
  WARN = 'warn',
  ERROR = 'error',
  NONE = 'none',
}

Editor Configuration

  • Editor of your preference. I used some VSCode specific config in .vscode folder and recommend plugins for enhanced experience.

Recommended VSCode Extensions:

  • Prettier (Official) - Code formatter
  • ESLint (Official) - Real time JS syntax validation

Technologies Used

Available Scripts For development

In the project directory, you can run:

yarn build

To build the project

yarn watch

To build with livereload

yarn fix:all

Runs prettier formatter followed by eslint, to format code and fix lint issues. Prettier is not good enough to run alone, must always be followed lint fixes included in this command.