UNPKG

logsilo

Version:

A lightweight logging utility for sending logs to a configured endpoint.

55 lines (54 loc) 1.48 kB
"use strict"; /** Copyright (c) MuteCode **/ Object.defineProperty(exports, "__esModule", { value: true }); exports.SiloLog = void 0; class SiloLog { constructor({ service, shortDescription, detailedDescription, level, user, path, statusCode, timestamp, }) { /** * Detailed description of the log. E.g. 'Request timed out at ...' */ this.detailedDescription = ''; /** * Severity level of the log (default is 1 which is an alert) */ this.level = 1; /** * Which user triggered the log */ this.user = ''; /** * Which route the log is related to */ this.path = ''; /** * Status code of the log */ this.statusCode = 0; /** * Timestamp of the log * Default is the current UTC time */ this.timestamp = new Date(); this.service = service; this.shortDescription = shortDescription; if (detailedDescription) { this.detailedDescription = detailedDescription; } if (level) { this.level = level; } if (user) { this.user = user; } if (path) { this.path = path; } if (statusCode) { this.statusCode = statusCode; } if (timestamp) { this.timestamp = timestamp; } } } exports.SiloLog = SiloLog;