How to use the @awesomeeng/awesome-log.AbstractLogFormatter function in @awesomeeng/awesome-log

To help you get started, we’ve selected a few @awesomeeng/awesome-log examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awesomeeng / awesome-log / examples / ExampleCustomFormatter / MyExampleFormatter.js View on Github external
timestamp,pid,level,system,message,args.

	We will also not do any spacing formatting, which
	is something the default formatter does.

	A formatter like this might be really useful when
	you need to sort logs by process id.
 */
"use strict";

// First we need to import AwesomeLog.
const Log = require("@awesomeeng/awesome-log");

// Next we need to expose the AwesomeLog.AbstractLogFormatter class which we
// will subclass in just a second.
const AbstractLogFormatter = Log.AbstractLogFormatter;

// So here we create our new writer class by subclassing
// AwesomeLog.AbstractLogFormatter.
//
// When you subclass AbstractLogFormatter you are required to implement
// two specific methods...
//
//		constructor(options)
//
// 		format(logentry)
//
class MyExampleFormatter extends AbstractLogFormatter {
	// Implement the constructor by just calling super.
	// In most cases for formatter, this is fine.
	constructor(options) {
		super(options);

@awesomeeng/awesome-log

AwesomeLog is a Log System for enterprise nodejs applications. It provides a basic out of the box logging solution that is ready to go with zero configuration but also gives you a highly configurable logging solution that with the power to do your logging

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis