# logfrog

> A simple log lib for front end.

Latest version **1.0.0** (published 2021-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install logfrog
pnpm add logfrog
yarn add logfrog
bun add logfrog
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-10-18 |
| First published | 2021-10-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 23.6 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | willx12123 |
| Maintainers | willx12123 |

## Links

- npm: https://www.npmjs.com/package/logfrog
- npm.io page: https://npm.io/package/logfrog

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.23.0
- [dayjs](https://npm.io/package/dayjs.md) ^1.10.7

## Recent versions

- 1.0.0 (latest) — 2021-10-18

## README

# logfrog

## Introduce 简介

Logger lib for front end.

1. Log level control: `DEBUG`, `INFO`, `WARN`, `ERROR`.
2. Log output format. Logman can print TEXT or JSON log.
3. Server log. Request your custom api with log.

前端日志库。

1. 日志等级控制 `DEBUG`, `INFO`, `WARN`, `ERROR`
2. 日志格式化输出，可输出文本格式或 JSON 格式
3. 服务端日志，传输日志至指定接口

## Example 示例

```ts
import { logger, Level, options } from "loggerman";

options.setLevel(Level.WARN);
options.setFormatter("json"); // "json" | "text"
options.setWriter("server"); // "server" | "console" | "all"
options.setRequestUrl("https://localhost:8080/logs");

logger.info("Init Successfully.");
logger.warn("Should warning you first.");
logger.error("Did task fail.");
```

```ts
// JSON output type.
// JSON 输出格式。

// Request body.
// 发送至服务器的数据格式。

export type LogType = {
  // Unix ms
  timestamp: number;
  level: LevelStr;
  message: string;
  extraFields?: { [key: string]: any };
};
```

---
_Source: https://npm.io/package/logfrog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
