# vue-logger

> the logger module for Vue.js

Latest version **0.0.4** (published 2018-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-logger
pnpm add vue-logger
yarn add vue-logger
bun add vue-logger
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2018-07-20 |
| First published | 2017-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | lluvio |
| Maintainers | lluvio |
| Keywords | vue, logger, log, jslog |

## Links

- npm: https://www.npmjs.com/package/vue-logger
- Repository: https://github.com/Lluvio/vue-logger
- Homepage: https://github.com/Lluvio/vue-logger#readme
- Issues: https://github.com/Lluvio/vue-logger/issues
- npm.io page: https://npm.io/package/vue-logger

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2018-07-20
- 0.0.3 — 2017-09-07
- 0.0.2 — 2017-08-01
- 0.0.1 — 2017-06-28

## README

# Vue logger

[![Ci](https://img.shields.io/circleci/project/github/lluvio/vue-logger.svg)](https://circleci.com/gh/Lluvio/vue-logger) [![Version](https://img.shields.io/npm/v/vue-logger.svg)](https://www.npmjs.com/package/vue-logger) [![License](https://img.shields.io/npm/l/vue-logger.svg)](https://www.npmjs.com/package/vue-logger) [![Downloads](https://img.shields.io/npm/dm/vue-logger.svg)](https://www.npmjs.com/package/vue-logger)

文档(Document): [English](./README_EN.md)

> 适用于 vue 1.x 和 2.x

## 安装

```bash
npm install vue-logger --save
```

## 使用

引入

```js
import vueLogger from "vue-logger";
Vue.use(vueLogger, {
  prefix: () => new Date(),
  dev: true,
  shortname: true,
  levels: ["log", "warn", "debug", "error", "dir"],
  forceLevels: []
});
```

调用

```js
export default {
  mounted() {
    // 当 shortname 为 true 时, 默认为true
    this.$error("hello world");

    // 全局使用
    Vue.console.log("hello world");
  }
};
```

默认 levels `['log', 'warn', 'debug', 'error', 'dir']`, 你可以额外添加，

```js
Vue.use(vueLogger, { levels: ["info"] });

// 在组件中使用
this.$info("hello world");
// log依旧可以使用
this.$log("hello world");
```

关于`shortname`，默认是 `true`，如果不想要别名，可以这么调用

```js
this.$console.log();
```

### Options

| Name        | Type    | Default                                  | Desc                                  |
| ----------- | ------- | ---------------------------------------- | ------------------------------------- |
| prefix      | string  | None                                     | 日志前缀，可以通过 `function`动态添加 |
| dev         | boolean | true                                     | 日志开关，可选择在生产环境中关闭      |
| shortname   | boolean | true                                     |                                       |
| levels      | array   | ['log', 'warn', 'debug', 'error', 'dir'] |                                       |
| forceLevels | array   | []                                       | 无视 dev 的配置 强制打印              |

## 开发

```bash
# install deps
npm install

# build dist files
npm run build

# run all tests
npm test
```

## TODO

- [ ] sentry

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