1.0.3 • Published 6 years ago
morgan-console v1.0.3
Morgan Console
morgan wrapper that logs using console.info
/console.error
. For use in environments where the process.stdout
/process.stderr
don't work, e.g. Google Cloud Functions.
const express = require('express');
const morganConsole = require('morgan-console');
const app = express();
app.use(morganConsole('combined'));
Anything morgan
would normally logged is logged to console.info
/console.error
in the combined
format.
Installation
npm:
npm install morgan-console
Yarn:
yarn add morgan-console
Usage
morganConsole(format , morgan)
Create a new morgan-console middleware function using the given format
and instance of morgan
. If no instance of morgan is passed in then a default one will be created. Passing your own morgan instance in lets you register your own tokens with morgan before constructing the morgan-console
middleware.