timer-logs
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "timer-logs", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"devDependencies": { | ||
@@ -13,3 +13,13 @@ "@types/node": "^" | ||
"license": "MIT", | ||
"types": "./Timer.d.ts" | ||
"types": "./Timer.d.ts", | ||
"scripts": { | ||
"build": "tsc --removeComments && tsc --declaration --emitDeclarationOnly" | ||
}, | ||
"keywords": [ | ||
"nodejs", | ||
"typescript", | ||
"logging", | ||
"timer", | ||
"google cloud logging" | ||
] | ||
} |
@@ -16,5 +16,6 @@ declare type Config = { | ||
}; | ||
/** filename of the typescript source file where the log is coming from */ | ||
filename: string; | ||
}; | ||
export declare class Timer { | ||
export default class Timer { | ||
private readonly startTime; | ||
@@ -27,4 +28,4 @@ private finishTime; | ||
* Create a new Timer object. Can have multiple timers within this object. | ||
* Should only have one of these per file | ||
* @param config optional configuration object with message and severity | ||
* Should only have one of these per file. Creating this object beings a timer automatically | ||
* @param config required configuration object, requires filename, others are optional | ||
*/ | ||
@@ -121,2 +122,5 @@ constructor(config: Config); | ||
} | ||
/** | ||
* Postgres error type thrown by pg library | ||
*/ | ||
declare type PostgresError = { | ||
@@ -123,0 +127,0 @@ message: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Timer = void 0; | ||
class Timer { | ||
@@ -107,2 +106,2 @@ constructor(config) { | ||
} | ||
exports.Timer = Timer; | ||
exports.default = Timer; |
18
Timer.ts
@@ -1,7 +0,1 @@ | ||
//todo: | ||
// - add the option of adding metadata to the log after its been started (details setter) | ||
// - make 'class' a built-in, required param in the constructor (force) | ||
// - add error handling methods, such as handlePostgresError(e) | ||
// this should really be in every single interface method, from the top to the return | ||
type Config = { | ||
@@ -20,3 +14,3 @@ /** | ||
details?: { [key: string]: string | number } | ||
// filename of the typescript source file where the log is coming from. Soon to become mandatory | ||
/** filename of the typescript source file where the log is coming from */ | ||
filename: string | ||
@@ -32,4 +26,4 @@ } | ||
* Create a new Timer object. Can have multiple timers within this object. | ||
* Should only have one of these per file | ||
* @param config optional configuration object with message and severity | ||
* Should only have one of these per file. Creating this object beings a timer automatically | ||
* @param config required configuration object, requires filename, others are optional | ||
*/ | ||
@@ -40,4 +34,2 @@ constructor(config: Config) { | ||
this.config.details = config?.details ?? {} | ||
// TODO: split filename by '/' and save each item as its own key:value in the log. | ||
// - such as ./interface/getCompanyProfile.ts becomes {level1:'interface', level2:'getCompanyProfile.ts'} | ||
this.savedTimes = {} | ||
@@ -216,3 +208,5 @@ if (this.config?.label !== undefined) this.start(this.config.label) | ||
} | ||
/** | ||
* Postgres error type thrown by pg library | ||
*/ | ||
type PostgresError = { | ||
@@ -219,0 +213,0 @@ message: string |
@@ -5,4 +5,3 @@ { | ||
"target": "ES2019", | ||
"sourceMap": false, | ||
"removeComments": true | ||
"sourceMap": false | ||
}, | ||
@@ -9,0 +8,0 @@ "exclude": [ |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
33082
8
1
150
480