2.0.3 • Published 1 year ago

@memw/betterconsole v2.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

BetterConsole

npm.io

This is a simple package that adds useful info to your console logs

installation

Using npm

npm install @memw/betterconsole

Usage

You need to import the module and run it as a function

require('@memw/betterconsole')(); // for cjs
(await import('@memw/betterconsole')).load(); // for es22

There is a little of configuration when the method is run, in terms of logging. These are the default values, but you can modify them as you wish

require('@memw/betterconsole')({logRoute: "", keepLogs: false, dateFormat: "h:mm:ss", ignoreLimits: false}); // for cjs
(await import('@memw/betterconsole')).load({logRoute: "", keepLogs: false, dateFormat: "h:mm:ss", ignoreLimits: false}); // for es22

Then you can just use the normal console methods

console.log("hello");
console.trace("hello");
console.debug("hello");
console.info("hello");
console.warn("hello");
console.error(true, "hello"); //first bool defines if it's gonna show stack trace (optional) true by default

If you want some custom log there is an alternative you might like

// color accepts an array and a string, you can add multiple colors, beware of bugs if you set the same field
console.customLog({color: "cyan", text: "whatever", stack: true}, "your log");

The configuration is entirely optional, if you don't put text it will simply not show, and if you don't set a color it will simply be white, stack is also optional, and it means if it will generate stack or not.

There is also an alternative method if you don't want to use the package function for that exact log

console.normalLog("hello");
2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.7.10

2 years ago

1.6.4

2 years ago

1.4.6

2 years ago

1.6.3

2 years ago

1.4.5

2 years ago

1.6.2

2 years ago

1.4.4

2 years ago

1.6.1

2 years ago

1.4.3

2 years ago

1.6.0

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.7.9

2 years ago

1.7.8

2 years ago

1.7.7

2 years ago

1.5.9

2 years ago

1.7.6

2 years ago

1.5.8

2 years ago

1.7.5

2 years ago

1.5.7

2 years ago

1.7.4

2 years ago

1.5.6

2 years ago

1.7.3

2 years ago

1.7.2

2 years ago

1.5.4

2 years ago

1.7.1

2 years ago

1.5.3

2 years ago

1.7.0

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.5.10

2 years ago

1.5.12

2 years ago

1.5.11

2 years ago

1.5.14

2 years ago

1.5.13

2 years ago

1.5.15

2 years ago

1.6.8

2 years ago

1.6.7

2 years ago

1.4.9

2 years ago

1.6.6

2 years ago

1.4.8

2 years ago

1.6.5

2 years ago

1.4.7

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago