Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@timberio/core

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@timberio/core - npm Package Compare versions

Comparing version 0.28.0 to 0.29.0

20

dist/cjs/base.d.ts

@@ -37,6 +37,6 @@ import { ITimberLog, ITimberOptions, LogLevel, Middleware, Sync } from "@timberio/types";

* @param level (LogLevel) - Level to log at (debug|info|warn|error)
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
log(message: string, level?: LogLevel, log?: Partial<ITimberLog>): Promise<ITimberLog>;
log(message: string, level?: LogLevel, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -47,6 +47,6 @@ *

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
debug(message: string, log?: Partial<ITimberLog>): Promise<ITimberLog>;
debug(message: string, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -57,6 +57,6 @@ *

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
info(message: string, log?: Partial<ITimberLog>): Promise<ITimberLog>;
info(message: string, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -67,6 +67,6 @@ *

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
warn(message: string, log?: Partial<ITimberLog>): Promise<ITimberLog>;
warn(message: string, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -77,6 +77,6 @@ *

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
error(message: string, log?: Partial<ITimberLog>): Promise<ITimberLog>;
error(message: string, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -83,0 +83,0 @@ * Sets the sync method - i.e. the final step in the pipeline to get logs

@@ -76,6 +76,6 @@ "use strict";

* @param level (LogLevel) - Level to log at (debug|info|warn|error)
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async log(message, level = types_1.LogLevel.Info, log = {}) {
async log(message, level = types_1.LogLevel.Info, context = {}) {
// Check that we have a sync function

@@ -88,9 +88,12 @@ if (typeof this._sync !== "function") {

// Build the initial log
const initialLog = Object.assign({
const initialLog = {
// Implicit date timestamp
dt: new Date() }, log, {
dt: new Date(),
// Add context
context,
// Explicit level
level,
// Explicit message
message });
message
};
// Pass the log through the middleware pipeline

@@ -110,7 +113,7 @@ const transformedLog = await this._middleware.reduceRight((fn, pipedLog) => fn.then(pipedLog), Promise.resolve(initialLog));

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async debug(message, log = {}) {
return this.log(message, types_1.LogLevel.Debug, log);
async debug(message, context) {
return this.log(message, types_1.LogLevel.Debug, context);
}

@@ -122,7 +125,7 @@ /**

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async info(message, log = {}) {
return this.log(message, types_1.LogLevel.Info, log);
async info(message, context) {
return this.log(message, types_1.LogLevel.Info, context);
}

@@ -134,7 +137,7 @@ /**

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async warn(message, log = {}) {
return this.log(message, types_1.LogLevel.Warn, log);
async warn(message, context) {
return this.log(message, types_1.LogLevel.Warn, context);
}

@@ -146,7 +149,7 @@ /**

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async error(message, log = {}) {
return this.log(message, types_1.LogLevel.Error, log);
async error(message, context) {
return this.log(message, types_1.LogLevel.Error, context);
}

@@ -153,0 +156,0 @@ /**

@@ -37,6 +37,6 @@ import { ITimberLog, ITimberOptions, LogLevel, Middleware, Sync } from "@timberio/types";

* @param level (LogLevel) - Level to log at (debug|info|warn|error)
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
log(message: string, level?: LogLevel, log?: Partial<ITimberLog>): Promise<ITimberLog>;
log(message: string, level?: LogLevel, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -47,6 +47,6 @@ *

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
debug(message: string, log?: Partial<ITimberLog>): Promise<ITimberLog>;
debug(message: string, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -57,6 +57,6 @@ *

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
info(message: string, log?: Partial<ITimberLog>): Promise<ITimberLog>;
info(message: string, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -67,6 +67,6 @@ *

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
warn(message: string, log?: Partial<ITimberLog>): Promise<ITimberLog>;
warn(message: string, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -77,6 +77,6 @@ *

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
error(message: string, log?: Partial<ITimberLog>): Promise<ITimberLog>;
error(message: string, context?: Pick<ITimberLog, "context">): Promise<ITimberLog>;
/**

@@ -83,0 +83,0 @@ * Sets the sync method - i.e. the final step in the pipeline to get logs

@@ -74,6 +74,6 @@ import { LogLevel } from "@timberio/types";

* @param level (LogLevel) - Level to log at (debug|info|warn|error)
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async log(message, level = LogLevel.Info, log = {}) {
async log(message, level = LogLevel.Info, context = {}) {
// Check that we have a sync function

@@ -86,9 +86,12 @@ if (typeof this._sync !== "function") {

// Build the initial log
const initialLog = Object.assign({
const initialLog = {
// Implicit date timestamp
dt: new Date() }, log, {
dt: new Date(),
// Add context
context,
// Explicit level
level,
// Explicit message
message });
message
};
// Pass the log through the middleware pipeline

@@ -108,7 +111,7 @@ const transformedLog = await this._middleware.reduceRight((fn, pipedLog) => fn.then(pipedLog), Promise.resolve(initialLog));

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async debug(message, log = {}) {
return this.log(message, LogLevel.Debug, log);
async debug(message, context) {
return this.log(message, LogLevel.Debug, context);
}

@@ -120,7 +123,7 @@ /**

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async info(message, log = {}) {
return this.log(message, LogLevel.Info, log);
async info(message, context) {
return this.log(message, LogLevel.Info, context);
}

@@ -132,7 +135,7 @@ /**

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async warn(message, log = {}) {
return this.log(message, LogLevel.Warn, log);
async warn(message, context) {
return this.log(message, LogLevel.Warn, context);
}

@@ -144,7 +147,7 @@ /**

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing
*/
async error(message, log = {}) {
return this.log(message, LogLevel.Error, log);
async error(message, context) {
return this.log(message, LogLevel.Error, context);
}

@@ -151,0 +154,0 @@ /**

{
"name": "@timberio/core",
"version": "0.28.0",
"version": "0.29.0",
"description": "Timber.io - logging core",

@@ -40,6 +40,6 @@ "keywords": [

"dependencies": {
"@timberio/tools": "^0.28.0",
"@timberio/types": "^0.28.0"
"@timberio/tools": "^0.29.0",
"@timberio/types": "^0.29.0"
},
"gitHead": "3d2d65b3111ec42d6ff1323cd9a4c0a5d5581722"
"gitHead": "1b125781ebe8fdf679f8c1ce5289251fc5975a39"
}

@@ -56,9 +56,7 @@ # 🌲 Timber - logging core

timber.log("Once more, with context", {
context: {
custom: {
"user-agent": {
browser: "Chrome"
}
}
}
custom: {
"user-agent": {
browser: "Chrome",
},
},
});

@@ -110,5 +108,5 @@ ```

id: 1000,
name: "Lee"
}
}
name: "Lee",
},
},
};

@@ -115,0 +113,0 @@ }

@@ -114,3 +114,3 @@ import {

* @param level (LogLevel) - Level to log at (debug|info|warn|error)
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing

@@ -121,3 +121,3 @@ */

level: LogLevel = LogLevel.Info,
log: Partial<ITimberLog> = {}
context: Pick<ITimberLog, "context"> = {}
): Promise<ITimberLog> {

@@ -137,4 +137,4 @@ // Check that we have a sync function

// Overwrite defaults / add context, with `log` object
...log,
// Add context
context,

@@ -169,3 +169,3 @@ // Explicit level

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing

@@ -175,5 +175,5 @@ */

message: string,
log: Partial<ITimberLog> = {}
context?: Pick<ITimberLog, "context">
): Promise<ITimberLog> {
return this.log(message, LogLevel.Debug, log);
return this.log(message, LogLevel.Debug, context);
}

@@ -186,3 +186,3 @@

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing

@@ -192,5 +192,5 @@ */

message: string,
log: Partial<ITimberLog> = {}
context?: Pick<ITimberLog, "context">
): Promise<ITimberLog> {
return this.log(message, LogLevel.Info, log);
return this.log(message, LogLevel.Info, context);
}

@@ -203,3 +203,3 @@

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing

@@ -209,5 +209,5 @@ */

message: string,
log: Partial<ITimberLog> = {}
context?: Pick<ITimberLog, "context">
): Promise<ITimberLog> {
return this.log(message, LogLevel.Warn, log);
return this.log(message, LogLevel.Warn, context);
}

@@ -220,3 +220,3 @@

* @param message: string - Log message
* @param log: (Partial<ITimberLog>) - Initial log (optional)
* @param context: (Pick<ITimberLog, "context">) - Context (optional)
* @returns Promise<ITimberLog> after syncing

@@ -226,5 +226,5 @@ */

message: string,
log: Partial<ITimberLog> = {}
context?: Pick<ITimberLog, "context">
): Promise<ITimberLog> {
return this.log(message, LogLevel.Error, log);
return this.log(message, LogLevel.Error, context);
}

@@ -231,0 +231,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc