0.1.4 • Published 2 years ago
@throvn/logc v0.1.4
logc - The Logging Library you I always wanted
This is a personal project of mine, which fixes a few issues I find annoying with the current implementation of console.log()
and other libraries.
This library works best in addition to your usual
console.log()
workflow.
Installation / Usage
npm i @throvn/logc
your/project/index.ts
import { log, logInfo } from "@throvn/logc";
logInfo("This is an example.");
function example(arg: any) {
// do some logic here
log(arg);
}
example("arg");
Output:
Documentation
Function | native equivalent | Colors | Prints caller |
---|---|---|---|
log(any[]) / logc(any[]) | console.log() | false | true |
logInfo(any[]) | console.info() | true | true |
logWarning(any[]) | console.warn() | true | true |
logError(any[]) | console.error() | true | true |
logTime(any[]) | - | false | false |
logTimePrecise(any[]) | - | false | false |
Do I plan to expand this? Idk, whenever I feel like something is missing, I will add/change it, eventually. (Maybe smth \w JSON)
If you have some ideas, PR's are welcome!
The issues & solutions:
- I'm lazy, when prototypes get bigger, you have trouble finding the right
console.log()
call. Thats why this library prints the calling function in front of the log output. - In the terminal, you cannot differentiate between the
err
andout
stream. Andconsole.warn()
calls suck too. That's why this library has visual feedback, which channel is the current one. - Alternative logging libraries have mostly the following issues:
- They are a complete replacement of
console.log()
, you cannot only use the things you like - The names are unneccessary long. (Again, I'm a lazy typer)
- They are a complete replacement of
This library is by no means designed to be an entire logging library. Just use it when you feel you need it.
It uses Typescript and has an built-in documentation.
It is freaking easy to use, just use it like console.log
.
Comes with NO bloatware.
Dependency free!