Skip to content

fg-devs/logging.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@NewCircuit/logging.js

A standard logging package for NewCircuit projects.

Install

Make sure you have an .npmrc in your project that adds the GitHub package registry.

# .npmrc
@newcircuit:registry=https://npm.pkg.github.com

Then install.

npm i @newcircuit/logging.js

Configuration

See log4js configuration

Class Example

const LogFactory = require('@newcircuit/logging.js');
// Put this instance where it's globally accessible.
const log = new LogFactory('info');

class Test {
	methodA() {
		// The last parameter is optional.
		const logger = log.getLogger('main', this, 'methodA');
		logger.info('This is a test!');
	}
}
const test = new Test();
test.methodA();

Output:

[2021-03-07T14:57:27.258] [INFO] [main] [Test.methodA()]: This is a test!

Function Example

const LogFactory = require('@newcircuit/logging.js');
// Put this instance where it's globally accessible.
const log = new LogFactory('info');

function test() {
	// The last parameter is optional.
	const logger = log.getLogger('main', test);
	logger.info('This is a test!');
}

test();

Output:

[2021-03-07T14:58:22.631] [INFO] [main] [test()]: This is a test!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages