1.0.3 • Published 3 years ago

@radixhaven/log-service v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Radix Haven Logger

Radix Haven npm package to track api services executions saving data history of main user actions in platform.

How to use

Step #1 Create a Global Instance of RadixHavenLogger and export it.

Note: This new intance need an pg connection object

const RadixHavenLogger = require('@radixhaven/log-service');
/** Using ECMAScript **/
import RadixHavenLogger from '@radixhaven/log-service';
const loggersh = new PgLogger({
	database: 'database_name',
	host: 'localhost',
	port: 5432,
	password: '******',
	user: 'postgres',
});

Step #2 Import the logger intance and execute it where you desire.

const loggersh = require('./logger');

And then use it

const lg = loggersh;
lg.logger({
	event_type: 'number', // Suggested data type format
	id_module: 'uuid',
	id_user: 'uuid',
	id_action: 'uuid',
	id_org: 'uuid',
	message_log: 'string',
	id_reference: 'uuid',
	client_so: 'string',
	client_ip: 'string',
	client_browser: 'string',
	metadata: 'json',
	response_status: 'number',
	country: 'string',
});

Powered by Radix Haven