Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

devlogger

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devlogger

HTTP request logger middleware for node.js

  • 0.0.6
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

devlogger

HTTP request logger middleware for node.js based on morgan

USAGE
"use strict";

var logger = require( 'devlogger' );
var express = require( 'express' );
var app = express();

function response( req, res ) {
    res.json( {result: "ok"} );
}

app.use( logger( 'dev' ) );
app.use( "/", response );
app.listen( 5000 );

result

-> 10:28:39.849 GET > 304 > / - Chrome 38.0.2125 > Other > Mac OS X 10.10.0 > 127.0.0.1
-> 10:36:55.310 GET > 200 > / - Mobile Safari 8.0 > iPhone > iOS 8.1 > 10.58.100.201

Or even

"use strict";

var logger = require( 'devlogger' );
var express = require( 'express' );
var app1 = express();
var app2 = express();
require( "colors" );

function response( req, res ) {
    res.json( {result: "ok"} );
}

app1.use( logger( 'SERVER1 '.green + logger.dev ) );
app1.use( "/", response );
app1.listen( 5000 );

app2.use( logger( 'SERVER2 '.blue + logger.dev ) );
app2.use( "/", response );
app2.listen( 5001 );

result

SERVER1 -> 10:36:55.310 GET > 200 > / - Mobile Safari 8.0 > iPhone > iOS 8.1 > 10.58.100.201
SERVER2 -> 10:45:30.287 GET > 304 > / - Chrome 38.0.2125 > Other > Mac OS X 10.10.0 > 127.0.0.1
SERVER2 -> 10:45:30.319 GET > 304 > /favicon.ico - Chrome 38.0.2125 > Other > Mac OS X 10.10.0 > 127.0.0.1
SERVER1 -> 10:45:42.220 GET > 304 > / - Mobile Safari 8.0 > iPhone > iOS 8.1 > 10.58.100.201
SERVER2 -> 10:45:44.415 GET > 200 > / - Mobile Safari 8.0 > iPhone > iOS 8.1 > 10.58.100.201

Modifications

Date format

The :date token takes a pattern parameter and formats the date using dateformat.

Example:
logger( '-> :date[HH:MM:ss.l] :method > :status ...' );

result

-> 10:28:39.849 GET > 304 ...

UA-parser

Devlogger also benefits of using ua-parser

Tokens:
  • :os
  • :browser
  • :device
Example:
logger( '-> :os > :device > :browser' )

result

-> Mobile Safari 8.0 > iPhone > iOS 8.1
-> Chrome 38.0.2125 > Other > Mac OS X 10.10.0

Keywords

FAQs

Package last updated on 25 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc