npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

swa-middleware-logger

v1.0.0

Published

用于swa平台的基于morgan的请求日志记录中间件。

Downloads

3

Readme

swa-middleware-logger

用于swa平台的基于morgan的请求日志记录中间件。

功能描述

基于morgan的请求日志记录中间件。该中间件记录记录较为详细的请求路径、及客户端信息以及相应状态, 在开发的时候方便开发人员调试, 在生产环境中产生的日志可以用于 统计分析请求筛查 等。

使用方式

var express = require('express');
var app = express();
app.use(require('swa-middleware-logger'));

配置信息

'swa-middleware-logger': {
  // 日志的存放目录,默认为/logs目录
  'logs-path': 'logs',
  // 请求日志的记录级别,可用值如下:swa-pro-1, swa-pro-2, swa-dev-1, combined, common, dev, short, tiny
  // swa-pro-1: {date::localedate, request:[real-ip::real-ip, other-end-ip::remote-addr, url::url, method::method, http::http-version, referrer::referrer, user-agent::user-agent], response:[status::status, response-time::response-time ms, length::res[content-length], type::res[content-type], location::res[location]]}
  // swa-pro-2: {date::localedate, request:[real-ip::real-ip, other-end-ip::remote-addr, url::url, method::method, http::http-version, referrer::referrer, query::query, body::body, user-agent::user-agent], response:[status::status, response-time::response-time ms, length::res[content-length], type::res[content-type], location::res[location]]}
  // swa-dev-1: :method :url :status query::query body::body :response-time ms - :res[content-length]
  // 详情请查看: https://www.npmjs.com/package/morgan
  'morgan-development': 'swa-dev-1',
  'morgan-production': 'swa-pro-2',
  // morgan 的immediate配置
  'morgan-immediate': false,
  // 是否记录请求日志
  'enabled': true
}