@adonisjs/logger
Advanced tools
Comparing version 5.2.0-0 to 5.3.0-0
@@ -0,7 +1,11 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import { Writable } from 'node:stream'; | ||
import { Logger } from '../src/logger.js'; | ||
import type { LoggerConfig } from '../src/types.js'; | ||
export declare function getFakeStream(fn: (line: string) => boolean): Writable; | ||
export declare class LoggerFactory { | ||
#private; | ||
pushLogsTo(collection: string[]): this; | ||
merge(options: LoggerConfig): this; | ||
create(): Logger<LoggerConfig>; | ||
} |
@@ -0,4 +1,15 @@ | ||
import { Writable } from 'node:stream'; | ||
import { Logger } from '../src/logger.js'; | ||
export function getFakeStream(fn) { | ||
const stream = new Writable(); | ||
stream.write = fn; | ||
return stream; | ||
} | ||
export class LoggerFactory { | ||
#options = {}; | ||
#logsCollection; | ||
pushLogsTo(collection) { | ||
this.#logsCollection = collection; | ||
return this; | ||
} | ||
merge(options) { | ||
@@ -9,4 +20,10 @@ Object.assign(this.#options, options); | ||
create() { | ||
if (this.#logsCollection) { | ||
this.#options.desination = getFakeStream((message) => { | ||
this.#logsCollection.push(message.trim()); | ||
return true; | ||
}); | ||
} | ||
return new Logger(this.#options); | ||
} | ||
} |
{ | ||
"name": "@adonisjs/logger", | ||
"version": "5.2.0-0", | ||
"version": "5.3.0-0", | ||
"description": "Logger built on top of pino to be used by AdonisJs", | ||
@@ -41,4 +41,4 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.4.1", | ||
"@commitlint/config-conventional": "^17.4.0", | ||
"@commitlint/cli": "^17.4.2", | ||
"@commitlint/config-conventional": "^17.4.2", | ||
"@japa/assert": "^1.3.6", | ||
@@ -49,3 +49,3 @@ "@japa/expect-type": "^1.0.2", | ||
"@japa/spec-reporter": "^1.3.2", | ||
"@swc/core": "^1.3.26", | ||
"@swc/core": "^1.3.27", | ||
"@types/node": "^18.11.18", | ||
@@ -55,3 +55,3 @@ "c8": "^7.12.0", | ||
"del-cli": "^5.0.0", | ||
"eslint": "^8.31.0", | ||
"eslint": "^8.32.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
@@ -64,3 +64,3 @@ "eslint-plugin-adonis": "^3.0.3", | ||
"pino-pretty": "^9.1.1", | ||
"prettier": "^2.8.2", | ||
"prettier": "^2.8.3", | ||
"ts-node": "^10.9.1", | ||
@@ -70,3 +70,3 @@ "typescript": "^4.9.4" | ||
"dependencies": { | ||
"@poppinss/utils": "^6.3.1-0", | ||
"@poppinss/utils": "^6.4.0-0", | ||
"@types/pino": "^7.0.5", | ||
@@ -73,0 +73,0 @@ "abstract-logging": "^2.0.1", |
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
21166
406
Updated@poppinss/utils@^6.4.0-0