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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fingerlabs-utils/fingerlabs-logger

v1.0.12

Published

log tools for fingerlabs

Readme

fingerlabs-logger

Install

npm install @fingerlabs-utils/fingerlabs-logger

requirements

npm install @types/node --save-dev

로그 정책 관련 내용

  • 로그 출력 정책 : production - console , development - console

  • 로그 레벨 정책 : production - info, development - debug

# 에러 로그 포맷 : “Timestamp + ServiceName + Level + RequestIp + Referrer + xForwardedFor + HttpMethod + Url + ResponseStatus + QueryParams + BodyParams + PathParams + "-" + ResponseTime + Agent + ErrorMessage”

# 예제 : "2022-11-09T07:09:19.981Z" "test" "error" "::ffff:127.0.0.1" "" "" "GET" "/" "200" "{}" "" "{}" - "" "curl/7.84.0" "Test"


# 엑세스 로그 포맷 [Morgan] : “Timestamp + ServiceName + RequestIp + Referrer + xForwardedFor + HttpMethod + Url + ResponseStatus + ResponseBodySize + ResponseTime + Agent”

# 예제 : 
# “2022-11-09T07:09:19.981Z" “FingerTheGraph” “15.164.157.43" “https://graph.fingerlabs.io/http/subgraphs/name/bellygom/graphql ” “125.131.114.50" “GET” “/http/subgraphs/name/bellygom” “200” “2079327" - “48.555 ms” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"


# 그 외 로그 포맷 [Winston] : “Timestamp + ServiceName + Level + Message”

# 예제 :
# “2022-11-09T07:09:19.981Z" “Favorlet-Service” “warn” “경고 문구”
# “2022-11-09T07:09:19.981Z" “Favorlet-Service” “error” “에러 발생하였습니다”

앞에 Nginx가 있는 서버의 경우 nginx 로그 포맷을 다음과 같이 맞춰주세요

nginx.conf

# nginx access 설정 log format 
log_format  main '$time_local ImportWorker $remote_addr $http_referer' '$http_x_forwarded_for $request $status $body_bytes_sent $request_time $http_user_agent';

How to use

엑세스 로그를 기록할 필요 할 경우. [앞에 Nginx 등의 웹 서버가 없는 Express server]

logger-utils.mts(ts) 작성

import fingerlabsLogger from '@fingerlabs-utils/fingerlabs-logger';

export default fingerlabsLogger.getFingerLogger({
  serviceName: '서비스명',
  nodeEnv: process.env.NODE_ENV,
  isHttp: true,
});

서버 사용 케이스 (express에서 로그 사용)

import express from 'express';
import loggerUtils from '../utils/logger-utils.ts';

const {
  logger,
  startTimeForRequestMiddleware,
  errorLogRequestMiddlewareWrapper
} = loggerUtils;

const app: Express = express();

// !!! 이 미들웨어는 가능한 미들웨어 중 최상단에 적용 시켜주시기 바랍니다 !!!
if (startTimeForRequestMiddleware) app.use(startTimeForRequestMiddleware);


// 에러 핸들러 이전에 리퀘스트 로그 미들웨어 적용
if (errorLogRequestMiddlewareWrapper) app.use(errorLogRequestMiddlewareWrapper(logger));

엑세스 로그를 따로 기록할 필요가 없는 경우. [프록시 서버를 경유 하거나 배치성의 서비스]

logger-utils.mts(ts) 작성

// 배치성 로그 사용 케이스 (isHttp = false)
import fingerlabsLogger from '@fingerlabs-utils/fingerlabs-logger';

export default fingerlabsLogger.getFingerLogger({
  serviceName: '서비스명',
  nodeEnv: process.env.NODE_ENV,
});

배치성 로그 사용 케이스 (스케줄러로 돌아가는 배치 스크립트 혹은 앞에 nginx 등의 프록시서버가 있어 Access Log가 이미 기록 되고 있는 서버의 경우.) [Beanstalk Worker 등]

!!!access log 기록하는 미들웨어를 사용하지 않는다!!![로그 중복 방지]

import loggerUtils from '../utils/logger-utils.ts';

const { logger } = loggerUtils;

// 에러 로그는 이렇게 찍어주세요!
logger.error('Error 발생');