ConsLog
The console, rewritten from scratch.
Usage
To install,
npm install conslog
or
yarn add conslog
After that, there are three ways to use ConsLog. The first way is to replace the console
object.
delete console;const console = ;
The second, semi-safe way is to move the console
object.
const v8 = ;const clone = { return v8;};const oldConsole = // Or however you want to deepclone.delete console;const console =
The third, safer way, is to include it as a separate package.
const cons = ;
Functions
console
is ConsLog,oldC
is the originalconsole
.
log
;
Logs to stdout
. Works exactly like oldC.log
except for the indentation.
warn
;
Logs to stdout
as a warning. Prefixed with 'warn' or head
.
info
;
Logs to stdout
as an information. Prefixed with 'info' or head
.
error
;
Logs to stdout
as an error. Doesn't throw. Prefixed with 'err' or head
.
success
;
Logs to stdout
as a success message. Prefixed with 'succ' or head
.
fatal
;
Logs to stdout
as a fatal error. Throws. Prefixed with 'fatal' or head
.
changeTheme
;
Sets the color theme. See the colors
doc for information on how to write a theme.
Variables
indentationSteps
;
How many spaces to indent each time.
maxIndent
;
The maximum indentation you can reach. Set to -1 for no limit.
msg
The prefixes applied to the specific logging functions.
License
MIT