0.3.1 • Published 1 month ago

named-logs-console v0.3.1

Weekly downloads
10
License
MIT
Repository
github
Last release
1 month ago

introduction

named-logs-console is an implementation of named-logs facade that redirect all call to console, preserving file/line.

It support namespace filtering like debug as well as log levels

By default the log level is 2 (warn)

install

npm install named-logs named-logs-console

use

in your index.js :

import {hookup} from 'named-logs-console';
hookup();

This will be default log all named-logs call

On a web page,

if the query string contains debug=<namespace> it will enable only the namespaces listed there (separated per commas)

if the query string contains log=<logLevel> it will set the global log level to the one specified.

For logging inside the app you can import named-logs This will allow you to extract that code into the library without importing the overhead of named-logs-console

import {logs} from 'named-logs';
const console = logs('app:test');

console.log('whatever you want');
console.error('an error occured');

But you can still access named logs via named-logs-console even one created by libraries and disable them programmatically for example:

import {logs} from 'named-logs-console';
logs('myLibrary').enabled = false;

You can also set global settings

import {logs} from 'named-logs-console';
logs.level = 0; // desactivate all
0.3.1

1 month ago

0.3.0

11 months ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.0.14

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago