xout
v1.0.4
Published
A simple logger with useful functions such as a JSON outputter, session output files, coloring, and more.
Downloads
2
Maintainers
Readme
XOUT
XOUT
is a basic, early-version logger that includes caller context information to help lightweight debug TypeScript programs. Currently, it can:
- Print time locale
- Use coloring
- Identify file, function, and line of the caller
- Set log status types (default, warn, error, debug, success, and baking)
- Log specific statuses to files for further review It also includes some other utilities.
Installation
To install, run:
npm i xout
Import
import { log, olog, toJSON, inf, demo } from 'xout';
Usage
Log
This is the default function.
log('Default log.');
log('Warn log.', STATUS.WARN);
log('Error log.', STATUS.ERROR);
log('Debug log.', STATUS.DEBUG);
log('Baking log.', STATUS.BAKING);
log('Done log.', STATUS.DONE);
log('Tabbed log.', null, true);
log('Headless log.', null, false, true);
Olog
Stands for "Object Logger", which recursively prints every key and their respective associated value for an inputted object.
let sampl = { name: 'hexcreator', thoughts_on_reader: 'they rock', nested: { child_name: 'none', child_gender: 'none' } };
olog('OLOG', sampl);
Others
The other available functions are:
toJSON
: converts an input to a JSON string.types
: dumps all property types in non-recursive manner for an object.inf
: prints an in-function progress line which is always tabbed.
Future Work
The config system could be better and more refined, as well as just a lot more tools that can be added. log
can also be cleaned up a bit.