3 Commits

Author SHA1 Message Date
naomi d46fba2bfc 0.0.1
Node.js CI / Lint and Test (pull_request) Successful in 29s
2025-02-10 20:41:43 -08:00
naomi bd1593d87d feat: include source maps in build 2025-02-10 20:41:28 -08:00
naomi a72ceaccd1 feat: initial prototype 2025-02-10 20:30:22 -08:00
2 changed files with 1 additions and 31 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@nhcarrigan/logger",
"version": "1.1.0-hotfix",
"version": "0.0.1",
"description": "Our custom logging package, which pipes logs to our alerts server.",
"type": "module",
"main": "prod/index.js",
-30
View File
@@ -71,34 +71,4 @@ export class Logger {
method: "POST",
});
}
/**
* Sends a counter metric to the alerting service.
* The alerting service is configured to handle aggregation, so you can send
* summative counts or individual increments. (e.g. Send a count of all users, or send a count of 1 every time a user joins).
* @param name -- The name of the metric to track.
* @param value -- The value of the metric to insert.
* @param metadata -- Any metadata to attach to the metric.
*/
public async metric(
name: string,
value: number,
metadata: Record<string, string | number | boolean>,
): Promise<void> {
await fetch(`${this.url}/metric`, {
body: JSON.stringify({
application: this.application,
metadata: metadata,
name: name,
value: value,
}),
headers: {
// eslint-disable-next-line @typescript-eslint/naming-convention -- Standard header name.
"Authorization": this.token,
// eslint-disable-next-line @typescript-eslint/naming-convention -- Standard header name.
"Content-Type": "application/json",
},
method: "POST",
});
}
}