@zodash/logger
Advanced tools
Comparing version 0.2.32 to 1.0.1
@@ -6,2 +6,33 @@ # Change Log | ||
## [1.0.1](https://github.com/zcorky/zodash/compare/@zodash/logger@0.3.0...@zodash/logger@1.0.1) (2022-08-25) | ||
### Bug Fixes | ||
* update logger version cause who used it to upgrade ([b0ec599](https://github.com/zcorky/zodash/commit/b0ec5996e134d6f3d36be76dbcc37ab28c469fdd)) | ||
# [0.3.0](https://github.com/zcorky/zodash/compare/@zodash/logger@0.2.33...@zodash/logger@0.3.0) (2022-08-24) | ||
### Features | ||
* **logger:** add queue ([be73bd8](https://github.com/zcorky/zodash/commit/be73bd82431ef2164bf064603c4cd48c3fb4cef9)) | ||
* **logger:** add queue ([c7d36bb](https://github.com/zcorky/zodash/commit/c7d36bb9dca3ad145bf07dc093b008604c5dff3b)) | ||
## [0.2.33](https://github.com/zcorky/zodash/compare/@zodash/logger@0.2.32...@zodash/logger@0.2.33) (2022-08-24) | ||
**Note:** Version bump only for package @zodash/logger | ||
## [0.2.32](https://github.com/zcorky/zodash/compare/@zodash/logger@0.2.31...@zodash/logger@0.2.32) (2022-07-22) | ||
@@ -8,0 +39,0 @@ |
@@ -26,2 +26,3 @@ import { Onion, Context, Middleware } from '@zodash/onion'; | ||
nameMinLength?: number; | ||
queueMaxLength?: number; | ||
} | ||
@@ -59,4 +60,5 @@ export declare enum LogLevel { | ||
setLogDir(logDir: string): void; | ||
getQueue(): Promise<Input[]>; | ||
} | ||
export declare function getLogger(name: string, options?: Options): Logger; | ||
export {}; |
@@ -7,2 +7,5 @@ "use strict"; | ||
const format_1 = require("@zodash/format"); | ||
// message queue to cache logs | ||
// default length 1000 | ||
let queue = []; | ||
var LogLevel; | ||
@@ -119,3 +122,3 @@ (function (LogLevel) { | ||
return async (ctx) => { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
const { input } = ctx; | ||
@@ -129,3 +132,8 @@ if (this.options.console === false) { | ||
: this.name.padEnd((_b = this.options) === null || _b === void 0 ? void 0 : _b.nameMinLength); | ||
const queueMaxLength = ((_c = this.options) === null || _c === void 0 ? void 0 : _c.queueMaxLength) || 1000; | ||
const message = this.getLogMessage(input.datetime, input.message, input.level); | ||
queue.unshift(input); | ||
if (queue.length > queueMaxLength) { | ||
queue = queue.slice(0, 1000); | ||
} | ||
const isUseDevConsole = Array.isArray(message); | ||
@@ -238,2 +246,5 @@ if (!isUseDevConsole) { | ||
} | ||
async getQueue() { | ||
return queue; | ||
} | ||
} | ||
@@ -240,0 +251,0 @@ exports.Logger = Logger; |
{ | ||
"name": "@zodash/logger", | ||
"version": "0.2.32", | ||
"version": "1.0.1", | ||
"description": "simple logger model", | ||
@@ -70,6 +70,6 @@ "keywords": [ | ||
"@zcorky/moment": "^1.2.3", | ||
"@zodash/format": "^1.3.1", | ||
"@zodash/onion": "^0.1.8" | ||
"@zodash/format": "^1.3.3", | ||
"@zodash/onion": "^0.1.10" | ||
}, | ||
"gitHead": "3467270f7e34778789129418c46d73266dd21ee5" | ||
"gitHead": "8e4041bf31658631e9ab9159e2103186fdea44b9" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
27022
356
0
Updated@zodash/format@^1.3.3
Updated@zodash/onion@^0.1.10