simple-javascript-logger
v1.0.3
Published
Very simple console wrapper in javascript. Preserves line numbers.
Downloads
36
Maintainers
Readme
Simple JavaScript Logger
Simple JavaScript Logger wrapper that preserves line numbers. Written in TypeScript, built with WebPack.
Example:
// Include simple-javascript-logger in your html.
<script src="simple-javascript-logger.js"></script>
// OR minified version
<script src="simple-javascript-logger.min.js"></script>
// In your javascript code, use it like this.
var logger = new Logger('MyLogger', 4); // Initialized with logging level 4. See below for logging level.
logger.Log('Hello World');
logger.Info('Hello World');
logger.Warn('Hello World');
logger.Error('Hello World');
// OR if you would like to use it as a module
import Logger = require('simple-javascript-logger');
Above code will result in:
Logging level
- Level 1: Only Error
- Level 2: Error and Warn
- Level 3: Error, Warn and Info
- Level 4: Error, Warn, Info and Log
How to build
npm install
packages. You can also useyarn install
.npm run build:dev
to build unminified version.npm run build:prod
to build minified version.