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

yyl-ssr-logger

v0.1.1

Published

yyl-ssr logger

Readme

yyl-ssr-logger

用于 yyl-ssr 项目 服务端 日志收集

安装

# yarn
yarn add yyl-ssr-logger

# npm
npm i yyl-ssr-logger --save

使用

import path from 'path'
import { Log, LogType } from 'yyl-ssr-logger'
const iLog = new Log({
  logPath: path.join(__dirname, 'log')
})
iLog.log({ type: LogType.Info, path: '/path/to/request', args: ['hello worl'] })

types

直接看 types 吧

/** 日志类型 */
export declare enum LogType {
  Info = 'info',
  Warn = 'warn',
  Error = 'error',
  Success = 'success',
  System = 'system'
}
/** 日志初始化配置 */
export interface LogOption<T> {
  /** 日志保存路径 */
  logPath?: string
  /** 运行日志存储上限 */
  runtimeLimitSize?: number
  /** 日志写入间隔 */
  writeInterval?: number
  /** 运行日志名称 */
  runtimeFilename?: string
  /** 错误日志名称 */
  errorFilename?: string
  /** 打印日志 */
  verbose?: boolean
  /** 格式化函数 */
  formatter?: (log: T & LogFormatOption) => string
  /** 日志分隔符 */
  logSep?: string
  /** debug 日志输出接受函数 */
  logger?: (type: LogType, args: any[]) => void
}
/** log 属性用 types */
export declare type LogProperty<T> = Required<LogOption<T>>
/** 日志入参 */
export interface LogArgu {
  /** 日志类型 */
  type?: LogType
  /** 请求路径 */
  path?: string
  /** 日志内容 */
  args: any[]
}
/** 日志 formatter 额外的参数 */
export interface LogFormatOption extends Required<LogArgu> {
  date: string
}
/** 日志对象 */
export declare class Log<T = {}> {
  /** 日志缓存 */
  private logCache
  /** interval key */
  private intervalKey
  /** 运行日志目录 */
  private runtimeLogPath
  /** 错误日志目录 */
  private errorLogPath
  /** 日志存储路径 */
  private logPath
  /** log 大小上限 */
  private runtimeLimitSize
  /** 日志写入间隔 */
  private writeInterval
  /** 打印日志 */
  private verbose
  /** 运行日志文件名 */
  private runtimeFilename
  /** 错误日志文件名 */
  private errorFilename
  /** 日志分隔符 */
  private logSep
  /** 日志解析器 */
  private formatter
  /** debug 日志接收器 */
  private logger
  constructor(option?: LogOption<T>)
  /** 日志记录 */
  log(op: T & LogArgu): void
  /** 日志写入操作 */
  private writer
  /** 日志清除 */
  clear(): void
}