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

suplus-logger

v0.0.2

Published

```text 是一个基于 浏览器 indexedDB 数据库 的日志库,用于记录日志信息。 ``` ## Installation ```shell npm install suplus-logger -D #or using pnpm: pnpm add suplus-logger -D ``` ## Example ```ts import Logger from 'suplus-logger'; // or use common: const Logger = require('suplus-l

Downloads

2

Readme

Getting Started

suplus-logger

是一个基于 浏览器 indexedDB 数据库 的日志库,用于记录日志信息。

Installation

npm install suplus-logger -D #or using pnpm: pnpm add suplus-logger -D

Example

import Logger from 'suplus-logger'; 
// or use common: const Logger = require('suplus-logger');

// 注: 数据库可以创建多个
// 但是不能动态创建多个仓库 比如 
// const database = await Logger.createDatabase("database", 1);
// const table = await database.createTable("table");
// 我已经创建好一个仓库了 但是
// const database = await Logger.createDatabase("database", 1);
// const table = await database.createTable("table");
// const table1 = await database.createTable("table1");
// 又创建了两个一个 table1 这个时候就会报错 
// 因为仓库需要在开始就需要定义好 当数据库已经创建完毕时 你再去创建仓库 就会报错
// 你需要改变数据库版本号 方可实现动态添加和删除仓库
// 官方解释:
/* 在IndexedDB中,当你想改变数据库的结构(比如添加、删除或修改ObjectStore)时,你必须在一个版本变更事务中完成这些操作。版本变更事务是一种特殊类型的事务,它允许你修改数据库的结构 */

// 示例 1:
Logger.createDatabase("名称","版本","是否输出在控制台").then((database)=>{
  database.createTable("仓库名称").then((table)=>{
    // 添加日志 总共有四个日志等级
    table.addLog("log", "DEBUG");
    table.addLog("log", "WARN"); 
    table.addLog("log", "INFO");
    table.addLog("log", "ERROR");
    // 导出日志
    table.exportLogs();
  })
})
// 示例 2:
const database = await logger.createDatabase("database", 1);
const table = await database.createTable("table");
table.addLog("log", "DEBUG");
table.exportLogs();