@jeffchi/logger 4.1.0-rc.0 → 4.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +14 -11
  2. package/package.json +8 -11
package/README.md CHANGED
@@ -12,16 +12,16 @@ A log print output javascript tool library that can be used at the front and bac
12
12
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
13
13
  [![JEST Report](https://github.com/poechiang/jeffchi-logger/actions/workflows/jest-report.yml/badge.svg)](https://github.com/poechiang/jeffchi-logger/actions/workflows/jest-report.yml)
14
14
 
15
- </div>
15
+
16
16
 
17
17
  ## 支持环境
18
18
 
19
19
  - 现代浏览器。
20
20
  - 支持服务端使用, 在服务端使用时默认写入 %root%/logs/yyyy-mm-dd.log 日志文件。
21
21
 
22
- | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera |
23
- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24
- | Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
22
+ | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)Opera |
23
+ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
24
+ | Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
25
25
 
26
26
  ## 安装
27
27
 
@@ -40,9 +40,9 @@ yarn add @jeffchi/logger
40
40
  ## 用法
41
41
 
42
42
  ```javascript
43
- import { withTags, loggerWithTags } from '@jeffchi/logger';
43
+ import { withTags } from '@jeffchi/logger';
44
44
  import { LogLevel, LogMode } from '@jeffchi/logger/lib/interface';
45
- const { debug, error, info, log, warn } = loggerWithTags(
45
+ const { debug, error, info, log, warn } = withTags(
46
46
  'api', // ['api','get'] 一个或多个tag
47
47
  {
48
48
  level: LogLevel.LOG, // 日志级别只有指定级别的日志才会输出至日志文件
@@ -75,9 +75,9 @@ export type LogTags = string | string[];
75
75
  /** 日志配置选项 */
76
76
  export interface ILogOptions {
77
77
  /** 日志级别
78
- * @default LogLevel.LOG
78
+ * @default [LogLevel.LOG]
79
79
  */
80
- level?: LogLevel;
80
+ levels?: LogLevel[];
81
81
  /**
82
82
  * 是否支持输出时间戳及时间戳格式
83
83
  *
@@ -102,7 +102,7 @@ export interface ILogOptions {
102
102
  * @description
103
103
  * 调用error输出错误信息后,默认继续抛出异常错误,在测试环境下可以临地禁用,避免影响正常的测试流程
104
104
  */
105
- ignoreThrow?: boolean;
105
+ disableThrow?: boolean;
106
106
  /**
107
107
  * 基于当前工程根目录下的日志输出文件
108
108
  *
@@ -110,10 +110,13 @@ export interface ILogOptions {
110
110
  * 浏览器环境:自动忽略该选项;
111
111
  *
112
112
  * node环境下默认 logs/xxx.log
113
- * @deprecated 由output代替
114
113
  */
115
- outputFile?: string;
116
114
  output?: string | LogOutputOptions;
115
+ /**
116
+ * 终端日志输出配色
117
+ * @version ^4.0+
118
+ */
119
+ color?: boolean;
117
120
  }
118
121
  ```
119
122
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeffchi/logger",
3
- "version": "4.1.0-rc.0",
3
+ "version": "4.2.0-alpha.0",
4
4
  "main": "lib/index.cjs",
5
5
  "module": "lib/index.mjs",
6
6
  "browser": "lib/index.cjs",
@@ -32,17 +32,11 @@
32
32
  "doc": "typedoc --options typedoc.json",
33
33
  "dev": "rollup -c --watch",
34
34
  "build": "npm run clear && rollup -c",
35
- "prepare": "npm run build",
35
+ "prepare": "husky install",
36
36
  "format": "prettier --write \"src/**/*.ts\"",
37
37
  "lint": "tslint -p tsconfig.json",
38
38
  "test": "jest --config jestconfig.json",
39
- "test:main": "jest ./src/__tests__/main.test.ts --config jestconfig.json",
40
- "prepush": "git add .",
41
- "push": "git commit -m",
42
- "postpush": "git push",
43
- "prepublishOnly": "npm run test main && npm run lint",
44
- "publish": "git push --follow-tags origin develop && npm publish",
45
- "release": "node release"
39
+ "test:main": "jest ./src/__tests__/main.test.ts --config jestconfig.json"
46
40
  },
47
41
  "author": "jeffery·chiang",
48
42
  "license": "MIT",
@@ -50,7 +44,7 @@
50
44
  ".": {
51
45
  "import": "./lib/index.mjs",
52
46
  "require": "./lib/index.cjs",
53
- "types": "./index.d.ts"
47
+ "types": "./lib/index.d.ts"
54
48
  }
55
49
  },
56
50
  "files": [
@@ -151,7 +145,10 @@
151
145
  "tslint": "^6.1.3",
152
146
  "tslint-config-prettier": "^1.18.0",
153
147
  "typedoc": "^0.23.24",
154
- "typescript": "^4.9.4"
148
+ "typescript": "^4.9.4",
149
+ "husky": "^9.0.0",
150
+ "@commitlint/cli": "^19.0.0",
151
+ "@commitlint/config-conventional": "^19.0.0"
155
152
  },
156
153
  "dependencies": {
157
154
  "date-fns": "^2.30.0"