@timberio/node
Advanced tools
Comparing version 0.30.0 to 0.31.0
/// <reference types="node" /> | ||
import { Duplex, Writable } from "stream"; | ||
import { ITimberLog, ITimberOptions, LogLevel } from "@timberio/types"; | ||
import { ITimberLog, Context, ITimberOptions, LogLevel } from "@timberio/types"; | ||
import { Base } from "@timberio/core"; | ||
@@ -20,3 +20,3 @@ export declare class Node extends Base { | ||
*/ | ||
log(message: string, level?: LogLevel, log?: Partial<ITimberLog>): Promise<ITimberLog>; | ||
log<TContext extends Context>(message: string, level?: LogLevel, context?: TContext): Promise<ITimberLog & TContext>; | ||
/** | ||
@@ -23,0 +23,0 @@ * Pipe JSON stringified `ITimberLog` to a stream after syncing |
@@ -50,5 +50,5 @@ "use strict"; | ||
*/ | ||
async log(message, level, log) { | ||
async log(message, level, context = {}) { | ||
// Process/sync the log, per `Base` logic | ||
const processedLog = await super.log(message, level, log); | ||
const processedLog = await super.log(message, level, context); | ||
// Push the processed log to the stream, for piping | ||
@@ -55,0 +55,0 @@ if (this._writeStream) { |
/// <reference types="node" /> | ||
import { Duplex, Writable } from "stream"; | ||
import { ITimberLog, ITimberOptions, LogLevel } from "@timberio/types"; | ||
import { ITimberLog, Context, ITimberOptions, LogLevel } from "@timberio/types"; | ||
import { Base } from "@timberio/core"; | ||
@@ -20,3 +20,3 @@ export declare class Node extends Base { | ||
*/ | ||
log(message: string, level?: LogLevel, log?: Partial<ITimberLog>): Promise<ITimberLog>; | ||
log<TContext extends Context>(message: string, level?: LogLevel, context?: TContext): Promise<ITimberLog & TContext>; | ||
/** | ||
@@ -23,0 +23,0 @@ * Pipe JSON stringified `ITimberLog` to a stream after syncing |
@@ -45,5 +45,5 @@ import fetch from "cross-fetch"; | ||
*/ | ||
async log(message, level, log) { | ||
async log(message, level, context = {}) { | ||
// Process/sync the log, per `Base` logic | ||
const processedLog = await super.log(message, level, log); | ||
const processedLog = await super.log(message, level, context); | ||
// Push the processed log to the stream, for piping | ||
@@ -50,0 +50,0 @@ if (this._writeStream) { |
{ | ||
"name": "@timberio/node", | ||
"version": "0.30.0", | ||
"version": "0.31.0", | ||
"description": "Timber.io - Node.js logger", | ||
@@ -43,5 +43,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@timberio/core": "^0.30.0", | ||
"@timberio/tools": "^0.30.0", | ||
"@timberio/types": "^0.30.0", | ||
"@timberio/core": "^0.31.0", | ||
"@timberio/tools": "^0.31.0", | ||
"@timberio/types": "^0.31.0", | ||
"@types/msgpack5": "^3.4.1", | ||
@@ -51,3 +51,3 @@ "cross-fetch": "^2.2.3", | ||
}, | ||
"gitHead": "16941238360eae52d6106dc864e11678fbac0636" | ||
"gitHead": "03cb2806851c894e300389565ceae08df857461a" | ||
} |
@@ -7,3 +7,3 @@ import { Duplex, Writable } from "stream"; | ||
import { base64Encode } from "@timberio/tools"; | ||
import { ITimberLog, ITimberOptions, LogLevel } from "@timberio/types"; | ||
import { ITimberLog, Context, ITimberOptions, LogLevel } from "@timberio/types"; | ||
import { Base } from "@timberio/core"; | ||
@@ -64,9 +64,9 @@ | ||
*/ | ||
public async log( | ||
public async log<TContext extends Context>( | ||
message: string, | ||
level?: LogLevel, | ||
log?: Partial<ITimberLog> | ||
): Promise<ITimberLog> { | ||
context: TContext = {} as TContext | ||
) { | ||
// Process/sync the log, per `Base` logic | ||
const processedLog = await super.log(message, level, log); | ||
const processedLog = await super.log(message, level, context); | ||
@@ -79,3 +79,3 @@ // Push the processed log to the stream, for piping | ||
// Return the transformed log | ||
return processedLog; | ||
return processedLog as ITimberLog & TContext; | ||
} | ||
@@ -82,0 +82,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
36191
+ Added@timberio/core@0.31.0(transitive)
+ Added@timberio/tools@0.31.0(transitive)
+ Added@timberio/types@0.31.0(transitive)
- Removed@timberio/core@0.30.0(transitive)
- Removed@timberio/tools@0.30.0(transitive)
- Removed@timberio/types@0.30.0(transitive)
Updated@timberio/core@^0.31.0
Updated@timberio/tools@^0.31.0
Updated@timberio/types@^0.31.0