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, { eLogLevel } from 'simple-javascript-logger';
Above code will result in:
- Level 1: Only Error
- Level 2: Error and Warn
- Level 3: Error, Warn and Info
- Level 4: Error, Warn, Info and Log
npm install
packages. You can also useyarn install
.npm run build:dev
to build unminified version.npm run build:prod
to build minified version.