1.0.0 • Published 8 years ago
console-power-shims v1.0.0
console-power-shims
Standardized console shims for common browsers and NodeJS.
Features
- Log level control via
console.setLevel() - Basic logging for browsers and NodeJS
console.log()console.info()console.warn()console.error()
Usage
require('console-powerlogs');
// Sets the logging level
// Default is to show all logs, or console.setLevel(0);
console.setLevel(1); // 1 = info, warn and error.
console.log('TMI'); // Will NOT display at this log level
console.info('Info'); // Will display
console.warn('Warning'); // Will display
console.error('Error'); // Will display- If
console.erroris not available,console.warnis used. - If
console.warnis not available,console.infois used. - If
console.infois not available,console.logis used. - If
console.logis not available, well... then this package is useless.
Functions
Logging
log(object , object, ...)
Outputs a log message. Pass one or more objects to this method. Each object is evaluated and concatenated into a space-delimited string.
info(object , object, ...)
Outputs an info log message. Pass one or more objects to this method. Each object is evaluated and concatenated into a space-delimited string.
warn(object , object, ...)
Outputs an warning log message. Pass one or more objects to this method. Each object is evaluated and concatenated into a space-delimited string.
error(object , object, ...)
Outputs an error log message. Pass one or more objects to this method. Each object is evaluated and concatenated into a space-delimited string.
Configuration
setLevel(integer)
Sets the logs level.
levelLog level0:[default]All logs -logand above1:infoand above2:warnand above3:error4: No logs
Future Features
- Standardized logging styles
- More shims
- Additional log levels
- Color support
- Style support
- Prefixing
1.0.0
8 years ago