@push.rocks/smartlog 3.1.9 → 3.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist_bundle/bundle.js
CHANGED
|
@@ -7,6 +7,10 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
7
7
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
8
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
9
|
};
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
10
14
|
var __copyProps = (to, from, except, desc) => {
|
|
11
15
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
16
|
for (let key of __getOwnPropNames(from))
|
|
@@ -41,6 +45,78 @@ var require_dist_ts = __commonJS({
|
|
|
41
45
|
}
|
|
42
46
|
});
|
|
43
47
|
|
|
48
|
+
// dist_ts_interfaces/index.js
|
|
49
|
+
var dist_ts_interfaces_exports = {};
|
|
50
|
+
__export(dist_ts_interfaces_exports, {
|
|
51
|
+
request: () => smartlog_interfaces_requests_exports
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// node_modules/.pnpm/@api.global+typedrequest-interfaces@3.0.19/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js
|
|
55
|
+
var dist_ts_exports = {};
|
|
56
|
+
|
|
57
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/index.js
|
|
58
|
+
var dist_ts_exports2 = {};
|
|
59
|
+
__export(dist_ts_exports2, {
|
|
60
|
+
business: () => business_exports,
|
|
61
|
+
code: () => code_exports,
|
|
62
|
+
container: () => container_exports,
|
|
63
|
+
content: () => content_exports,
|
|
64
|
+
database: () => database_exports,
|
|
65
|
+
descriptors: () => descriptors_exports,
|
|
66
|
+
finance: () => finance_exports,
|
|
67
|
+
general: () => general_exports,
|
|
68
|
+
network: () => network_exports,
|
|
69
|
+
saas: () => saas_exports,
|
|
70
|
+
storage: () => storage_exports,
|
|
71
|
+
website: () => website_exports
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/business/index.js
|
|
75
|
+
var business_exports = {};
|
|
76
|
+
|
|
77
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/database/index.js
|
|
78
|
+
var database_exports = {};
|
|
79
|
+
|
|
80
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/finance/index.js
|
|
81
|
+
var finance_exports = {};
|
|
82
|
+
|
|
83
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/code/index.js
|
|
84
|
+
var code_exports = {};
|
|
85
|
+
|
|
86
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/container/index.js
|
|
87
|
+
var container_exports = {};
|
|
88
|
+
|
|
89
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/descriptors/index.js
|
|
90
|
+
var descriptors_exports = {};
|
|
91
|
+
|
|
92
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/content/index.js
|
|
93
|
+
var content_exports = {};
|
|
94
|
+
|
|
95
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/general/index.js
|
|
96
|
+
var general_exports = {};
|
|
97
|
+
|
|
98
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/network/index.js
|
|
99
|
+
var network_exports = {};
|
|
100
|
+
__export(network_exports, {
|
|
101
|
+
ICnameDescriptor: () => ICnameDescriptor
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/network/cname.js
|
|
105
|
+
var ICnameDescriptor = class {
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/saas/index.js
|
|
109
|
+
var saas_exports = {};
|
|
110
|
+
|
|
111
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/storage/index.js
|
|
112
|
+
var storage_exports = {};
|
|
113
|
+
|
|
114
|
+
// node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/website/index.js
|
|
115
|
+
var website_exports = {};
|
|
116
|
+
|
|
117
|
+
// dist_ts_interfaces/smartlog-interfaces.requests.js
|
|
118
|
+
var smartlog_interfaces_requests_exports = {};
|
|
119
|
+
|
|
44
120
|
// ts/smartlog.plugins.ts
|
|
45
121
|
var isounique = __toESM(require_dist_ts(), 1);
|
|
46
122
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../node_modules/.pnpm/@push.rocks+isounique@1.0.5/node_modules/@push.rocks/isounique/ts/index.ts", "../ts/smartlog.plugins.ts", "../ts/smartlog.classes.consolelog.ts", "../ts/smartlog.classes.logrouter.ts", "../ts/smartlog.classes.smartlog.ts", "../ts/smartlog.classes.loggroup.ts"],
|
|
4
|
-
"sourcesContent": [null, "import * as isounique from '@push.rocks/isounique';\nimport * as smartlogInterfaces from '../dist_ts_interfaces/index.js';\n\nexport { isounique, smartlogInterfaces };\n", "import * as plugins from './smartlog.plugins.js';\n\n/**\n * a console log optimized for smartlog\n */\nexport class ConsoleLog {\n public log(\n logLevelArg: plugins.smartlogInterfaces.TLogLevel,\n logMessageArg: string,\n dataArg?: any,\n correlationArg?: plugins.smartlogInterfaces.ILogCorrelation,\n ) {\n console.log(`__# ${logLevelArg}: ${logMessageArg}`);\n }\n}\n", "import * as plugins from './smartlog.plugins.js';\n\nexport class LogRouter {\n /**\n * all log destinations\n */\n private logDestinations: plugins.smartlogInterfaces.ILogDestination[] = [];\n\n constructor() {}\n\n public addLogDestination(logDestination: plugins.smartlogInterfaces.ILogDestination) {\n this.logDestinations.push(logDestination);\n }\n\n // routes the log according to added logDestinations\n public async routeLog(logPackageArg: plugins.smartlogInterfaces.ILogPackage) {\n for (const logDestination of this.logDestinations) {\n await logDestination.handleLog(logPackageArg);\n }\n }\n}\n", "import * as plugins from './smartlog.plugins.js';\n\nimport { LogRouter } from './smartlog.classes.logrouter.js';\nimport { LogGroup } from './smartlog.classes.loggroup.js';\n\nexport interface ISmartlogContructorOptions {\n logContext: plugins.smartlogInterfaces.ILogContext;\n minimumLogLevel?: plugins.smartlogInterfaces.TLogLevel;\n}\n\nexport class Smartlog implements plugins.smartlogInterfaces.ILogDestination {\n // STATIC\n public static createForCommitinfo(\n commitinfo: plugins.smartlogInterfaces.ILogContext['commitinfo'],\n ) {\n return new Smartlog({\n logContext: {\n commitinfo,\n },\n });\n }\n\n // INSTANCE\n public logContext: plugins.smartlogInterfaces.ILogContext;\n public minimumLogLevel: plugins.smartlogInterfaces.TLogLevel;\n\n public uniInstanceId: string = plugins.isounique.uni();\n\n private consoleEnabled: boolean;\n\n private logRouter = new LogRouter();\n\n public addLogDestination(logDestinationArg: plugins.smartlogInterfaces.ILogDestination) {\n this.logRouter.addLogDestination(logDestinationArg);\n }\n\n constructor(optionsArg: ISmartlogContructorOptions) {\n this.logContext = optionsArg.logContext;\n this.minimumLogLevel = optionsArg.minimumLogLevel || 'silly';\n }\n\n // ============\n // Logger Setup\n // ============\n\n /**\n * enables console logging\n */\n public enableConsole(optionsArg?: { captureAll: boolean }) {\n if (globalThis.process && optionsArg && optionsArg.captureAll) {\n const process = globalThis.process;\n const originalStdoutWrite = process.stdout.write.bind(process.stdout);\n const originalStderrWrite = process.stderr.write.bind(process.stderr);\n\n process.stdout.write = (...args: any) => {\n const logString: string = args[0];\n if (!logString || typeof logString !== 'string') {\n // continue as planned\n return originalStdoutWrite(...args);\n }\n\n if (!logString.startsWith('LOG')) {\n if (logString.includes('Error:')) {\n this.log('error', logString);\n } else {\n this.log('info', logString);\n }\n return true;\n }\n\n return originalStdoutWrite(...args);\n };\n\n process.stderr.write = (...args: any) => {\n const logString: string = args[0];\n if (!logString || typeof logString !== 'string' || !logString.startsWith('LOG')) {\n this.log('error', logString);\n return true;\n }\n return originalStderrWrite(...args);\n };\n }\n this.consoleEnabled = true;\n }\n\n // =============\n // log functions\n // =============\n /**\n * main log method\n * @param logLevelArg - the log level\n * @param logMessageArg - the log message\n * @param logDataArg - any additional log data\n * @param correlationArg - info about corrleations\n */\n public async log(\n logLevelArg: plugins.smartlogInterfaces.TLogLevel,\n logMessageArg: string,\n logDataArg?: any,\n correlationArg?: plugins.smartlogInterfaces.ILogCorrelation,\n ) {\n correlationArg = {\n ...{\n id: plugins.isounique.uni(),\n type: 'none',\n instance: this.uniInstanceId,\n },\n ...correlationArg,\n };\n\n if (this.consoleEnabled) {\n this.safeConsoleLog(`${logLevelArg}: ${logMessageArg}`);\n }\n\n const logPackage: plugins.smartlogInterfaces.ILogPackage = {\n timestamp: Date.now(),\n type: 'log',\n context: this.logContext,\n level: logLevelArg,\n correlation: correlationArg,\n message: logMessageArg,\n };\n if (logDataArg) {\n logPackage.data = logDataArg;\n }\n await this.logRouter.routeLog(logPackage);\n }\n\n public increment(\n logLevelArg: plugins.smartlogInterfaces.TLogLevel,\n logMessageArg: string,\n logDataArg?: any,\n correlationArg: plugins.smartlogInterfaces.ILogCorrelation = {\n id: plugins.isounique.uni(),\n type: 'none',\n },\n ) {\n if (this.consoleEnabled) {\n this.safeConsoleLog(`INCREMENT: ${logLevelArg}: ${logMessageArg}`);\n }\n this.logRouter.routeLog({\n timestamp: Date.now(),\n type: 'increment',\n context: this.logContext,\n level: logLevelArg,\n message: logMessageArg,\n correlation: correlationArg,\n });\n }\n\n public async handleLog(logPackageArg: plugins.smartlogInterfaces.ILogPackage) {\n await this.logRouter.routeLog(logPackageArg);\n }\n\n private safeConsoleLog(logLine: string) {\n console.log(\n `LOG => ${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()} => ${logLine}`,\n );\n }\n\n public createLogGroup(transactionId: string = 'none') {\n return new LogGroup(this, transactionId);\n }\n}\n", "import * as plugins from './smartlog.plugins.js';\nimport { Smartlog } from './smartlog.classes.smartlog.js';\n\nexport class LogGroup {\n public smartlogRef: Smartlog;\n public transactionId: string;\n public groupId = plugins.isounique.uni();\n\n constructor(smartlogInstance: Smartlog, transactionIdArg: string) {\n this.smartlogRef = smartlogInstance;\n this.transactionId = transactionIdArg;\n }\n\n public log(\n logLevelArg: plugins.smartlogInterfaces.TLogLevel,\n logMessageArg: string,\n logDataArg?: any,\n ) {\n this.smartlogRef.log(logLevelArg, logMessageArg, logDataArg, {\n id: plugins.isounique.uni(),\n type: 'none',\n group: this.groupId,\n instance: this.smartlogRef.uniInstanceId,\n transaction: this.transactionId,\n });\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
3
|
+
"sources": ["../node_modules/.pnpm/@push.rocks+isounique@1.0.5/node_modules/@push.rocks/isounique/ts/index.ts", "../ts_interfaces/index.ts", "../node_modules/.pnpm/@api.global+typedrequest-interfaces@3.0.19/node_modules/@api.global/typedrequest-interfaces/dist_ts/index.js", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/business/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/database/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/finance/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/code/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/container/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/descriptors/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/content/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/general/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/network/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/network/cname.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/saas/index.ts", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/dist_ts/storage/index.js", "../node_modules/.pnpm/@tsclass+tsclass@9.2.0/node_modules/@tsclass/tsclass/ts/website/index.ts", "../ts_interfaces/smartlog-interfaces.requests.ts", "../ts/smartlog.plugins.ts", "../ts/smartlog.classes.consolelog.ts", "../ts/smartlog.classes.logrouter.ts", "../ts/smartlog.classes.smartlog.ts", "../ts/smartlog.classes.loggroup.ts"],
|
|
4
|
+
"sourcesContent": ["export const uni = (prefix: string = 'uni') => {\n return `${prefix}_${`xxxxxxxxxxxxxxxxxxxxxxxx`.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n })}`;\n};\n", "import * as plugins from './smartlog-interfaces.plugins.js';\n\nimport * as requestInterfaces from './smartlog-interfaces.requests.js';\n\nexport { requestInterfaces as request };\n\n/**\n * the different available log types\n */\nexport type TLogType =\n | 'log'\n | 'increment'\n | 'gauge'\n | 'error'\n | 'success'\n | 'value'\n | 'finance'\n | 'compliance';\n\n/**\n * the available log levels\n */\nexport type TLogLevel =\n | 'silly'\n | 'info'\n | 'debug'\n | 'note'\n | 'ok'\n | 'success'\n | 'warn'\n | 'error'\n | 'lifecycle';\n\n/**\n * the available environments\n */\nexport type TEnvironment = 'local' | 'test' | 'staging' | 'production';\n\n/**\n * the available runtimes\n */\nexport type TRuntime = 'node' | 'chrome' | 'rust' | 'deno' | 'cloudflare_workers';\n\n/**\n * the log context e.g. what app in what version on what server\n */\nexport interface ILogContext {\n commitinfo?: plugins.tsclass.code.ICommitInfo;\n company?: string;\n companyunit?: string;\n containerName?: string;\n environment?: TEnvironment;\n runtime?: TRuntime;\n zone?: string;\n}\n\nexport interface ILogCorrelation {\n /**\n * a unique id for this log\n */\n id: string;\n /**\n * the type of this log\n */\n type: 'none' | 'service' | 'build' | 'infrastructure' | 'cdn';\n /**\n * the instance on which the log is created\n * use it for pinning logs to a certain instance in a cluster\n */\n instance?: string;\n /**\n * a series of logs\n */\n group?: string;\n /**\n * a log that belongs to a transaction. E.g. a Payment or a request traveling through multiple backend instances\n */\n transaction?: string;\n}\n\n/**\n * the main logpackage\n */\nexport interface ILogPackage<T = unknown> {\n /**\n * a unix timestamp in milliseconds\n */\n timestamp: number;\n type: TLogType;\n context: ILogContext;\n level: TLogLevel;\n /**\n * allows grouping of log messages\n */\n correlation: ILogCorrelation;\n /**\n * the message to log\n */\n message: string;\n data?: T;\n}\n\nexport interface ILogPackageDataRequest {\n requestCorrelationId: string;\n url: string;\n pathname: string;\n method: string;\n status: string;\n}\n\nexport interface ILogPackageAuthenticated {\n auth: string;\n logPackage: ILogPackage;\n}\n\nexport interface ILogPackageArrayAuthenticated {\n auth: string;\n logPackages: ILogPackage[];\n}\n\n/**\n * a destination interface for extending smartlog modules\n */\nexport interface ILogDestination {\n handleLog: (logPackage: ILogPackage) => Promise<void>;\n}\n", "export {};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=", "// Business\nimport * as business from './business/index.js';\n\n// Code\nimport * as code from './code/index.js';\n\n// Container\nimport * as container from './container/index.js';\n\n// Database\nimport * as database from './database/index.js';\n\n// Descriptors \nimport * as descriptors from './descriptors/index.js';\n\n// Finance\nimport * as finance from './finance/index.js';\n\n// Content\nimport * as content from './content/index.js';\n\n// General\nimport * as general from './general/index.js';\n\n// Network\nimport * as network from './network/index.js';\n\n// SaaS\nimport * as saas from './saas/index.js';\n\n// Storage\nimport * as storage from './storage/index.js';\n\n// Website\nimport * as website from './website/index.js';\n\nexport {\n business,\n container,\n code,\n database,\n descriptors,\n finance,\n content,\n general,\n network,\n saas,\n storage,\n website,\n};\n\nimport type * as typeFest from 'type-fest';\nimport * as typeFestOwn from './typefest.own.js';\n\nexport { type typeFest, type typeFestOwn };\n", "export * from './address.js';\nexport * from './contact.js';\nexport * from './document.js';\nexport * from './job.js';\nexport * from './letter.js';\nexport * from './pdf.js';\nexport * from './project.js';\n", "export * from './mongodescriptor.js';\nexport * from './objectaction.js';\nexport * from './objectstatus.js';\nexport * from './wrappeddata.js';\n", "export * from './checkingaccount.js';\nexport * from './currency.js';\nexport * from './expense.js';\nexport * from './accountingdoc.js';\nexport * from './payment.js';\nexport * from './transaction.js';\n", "export * from './commitinfo.js';\nexport * from './statusobject.js';", "export * from './container.js';\nexport * from './volumemount.js';\n", "export type { IMongoDescriptor } from '../database/index.js';\n\nexport interface ICloudflareDescriptor {\n authToken: string;\n};\n\nexport interface ILetterExpressDescriptor {\n email: string,\n apiToken: string,\n}\n", "export * from './article.js';\nexport * from './author.js';\nexport * from './documentationset.js';\n", "export * from './date.js';\nexport * from './time.js';\n", "export * from './cert.js';\nexport * from './cname.js';\nexport * from './device.js';\nexport * from './dns.js';\nexport * from './dnschallenge.js';\nexport * from './dnsconvenience.js';\nexport * from './domaindelegation.js';\nexport * from './jwt.js';\nexport * from './networknode.js';\nexport * from './request.js';\nexport * from './reverseproxy.js';\nexport * from './ssh.js';\n", "import { type ICert } from './cert.js';\n\nexport class ICnameDescriptor {\n /**\n * the original domain that is being cnamed\n */\n cnamedDomain: string;\n\n /**\n * the cname proxy domain\n * the domain that is used for the cname dns entry\n */\n cnameProxyDomain: string;\n\n /**\n * the internal target url\n */\n targetUrl: string;\n\n /**\n * a description\n */\n description: string;\n\n /**\n * the ssl certificate\n */\n sslCertificate?: ICert;\n}\n", "export * from './subscriptionplan.js';\nexport * from './product.js';\n", "export {};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9zdG9yYWdlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==", "export * from './link.js';\nexport * from './menuitem.js';\nexport * from './linkblock.js';\n", "import { type ILogPackageAuthenticated } from './index.js';\n\nexport interface IRequest_SmartlogDestinationReceiver_Any_PostLogPackages {\n method: 'postLogPackages';\n request: {\n logPackages: ILogPackageAuthenticated[];\n };\n response: {};\n}\n", "import * as isounique from '@push.rocks/isounique';\nimport * as smartlogInterfaces from '../dist_ts_interfaces/index.js';\n\nexport { isounique, smartlogInterfaces };\n", "import * as plugins from './smartlog.plugins.js';\n\n/**\n * a console log optimized for smartlog\n */\nexport class ConsoleLog {\n public log(\n logLevelArg: plugins.smartlogInterfaces.TLogLevel,\n logMessageArg: string,\n dataArg?: any,\n correlationArg?: plugins.smartlogInterfaces.ILogCorrelation,\n ) {\n console.log(`__# ${logLevelArg}: ${logMessageArg}`);\n }\n}\n", "import * as plugins from './smartlog.plugins.js';\n\nexport class LogRouter {\n /**\n * all log destinations\n */\n private logDestinations: plugins.smartlogInterfaces.ILogDestination[] = [];\n\n constructor() {}\n\n public addLogDestination(logDestination: plugins.smartlogInterfaces.ILogDestination) {\n this.logDestinations.push(logDestination);\n }\n\n // routes the log according to added logDestinations\n public async routeLog(logPackageArg: plugins.smartlogInterfaces.ILogPackage) {\n for (const logDestination of this.logDestinations) {\n await logDestination.handleLog(logPackageArg);\n }\n }\n}\n", "import * as plugins from './smartlog.plugins.js';\n\nimport { LogRouter } from './smartlog.classes.logrouter.js';\nimport { LogGroup } from './smartlog.classes.loggroup.js';\n\nexport interface ISmartlogContructorOptions {\n logContext: plugins.smartlogInterfaces.ILogContext;\n minimumLogLevel?: plugins.smartlogInterfaces.TLogLevel;\n}\n\nexport class Smartlog implements plugins.smartlogInterfaces.ILogDestination {\n // STATIC\n public static createForCommitinfo(\n commitinfo: plugins.smartlogInterfaces.ILogContext['commitinfo'],\n ) {\n return new Smartlog({\n logContext: {\n commitinfo,\n },\n });\n }\n\n // INSTANCE\n public logContext: plugins.smartlogInterfaces.ILogContext;\n public minimumLogLevel: plugins.smartlogInterfaces.TLogLevel;\n\n public uniInstanceId: string = plugins.isounique.uni();\n\n private consoleEnabled: boolean;\n\n private logRouter = new LogRouter();\n\n public addLogDestination(logDestinationArg: plugins.smartlogInterfaces.ILogDestination) {\n this.logRouter.addLogDestination(logDestinationArg);\n }\n\n constructor(optionsArg: ISmartlogContructorOptions) {\n this.logContext = optionsArg.logContext;\n this.minimumLogLevel = optionsArg.minimumLogLevel || 'silly';\n }\n\n // ============\n // Logger Setup\n // ============\n\n /**\n * enables console logging\n */\n public enableConsole(optionsArg?: { captureAll: boolean }) {\n if (globalThis.process && optionsArg && optionsArg.captureAll) {\n const process = globalThis.process;\n const originalStdoutWrite = process.stdout.write.bind(process.stdout);\n const originalStderrWrite = process.stderr.write.bind(process.stderr);\n\n process.stdout.write = (...args: any) => {\n const logString: string = args[0];\n if (!logString || typeof logString !== 'string') {\n // continue as planned\n return originalStdoutWrite(...args);\n }\n\n if (!logString.startsWith('LOG')) {\n if (logString.includes('Error:')) {\n this.log('error', logString);\n } else {\n this.log('info', logString);\n }\n return true;\n }\n\n return originalStdoutWrite(...args);\n };\n\n process.stderr.write = (...args: any) => {\n const logString: string = args[0];\n if (!logString || typeof logString !== 'string' || !logString.startsWith('LOG')) {\n this.log('error', logString);\n return true;\n }\n return originalStderrWrite(...args);\n };\n }\n this.consoleEnabled = true;\n }\n\n // =============\n // log functions\n // =============\n /**\n * main log method\n * @param logLevelArg - the log level\n * @param logMessageArg - the log message\n * @param logDataArg - any additional log data\n * @param correlationArg - info about corrleations\n */\n public async log(\n logLevelArg: plugins.smartlogInterfaces.TLogLevel,\n logMessageArg: string,\n logDataArg?: any,\n correlationArg?: plugins.smartlogInterfaces.ILogCorrelation,\n ) {\n correlationArg = {\n ...{\n id: plugins.isounique.uni(),\n type: 'none',\n instance: this.uniInstanceId,\n },\n ...correlationArg,\n };\n\n if (this.consoleEnabled) {\n this.safeConsoleLog(`${logLevelArg}: ${logMessageArg}`);\n }\n\n const logPackage: plugins.smartlogInterfaces.ILogPackage = {\n timestamp: Date.now(),\n type: 'log',\n context: this.logContext,\n level: logLevelArg,\n correlation: correlationArg,\n message: logMessageArg,\n };\n if (logDataArg) {\n logPackage.data = logDataArg;\n }\n await this.logRouter.routeLog(logPackage);\n }\n\n public increment(\n logLevelArg: plugins.smartlogInterfaces.TLogLevel,\n logMessageArg: string,\n logDataArg?: any,\n correlationArg: plugins.smartlogInterfaces.ILogCorrelation = {\n id: plugins.isounique.uni(),\n type: 'none',\n },\n ) {\n if (this.consoleEnabled) {\n this.safeConsoleLog(`INCREMENT: ${logLevelArg}: ${logMessageArg}`);\n }\n this.logRouter.routeLog({\n timestamp: Date.now(),\n type: 'increment',\n context: this.logContext,\n level: logLevelArg,\n message: logMessageArg,\n correlation: correlationArg,\n });\n }\n\n public async handleLog(logPackageArg: plugins.smartlogInterfaces.ILogPackage) {\n await this.logRouter.routeLog(logPackageArg);\n }\n\n private safeConsoleLog(logLine: string) {\n console.log(\n `LOG => ${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()} => ${logLine}`,\n );\n }\n\n public createLogGroup(transactionId: string = 'none') {\n return new LogGroup(this, transactionId);\n }\n}\n", "import * as plugins from './smartlog.plugins.js';\nimport { Smartlog } from './smartlog.classes.smartlog.js';\n\nexport class LogGroup {\n public smartlogRef: Smartlog;\n public transactionId: string;\n public groupId = plugins.isounique.uni();\n\n constructor(smartlogInstance: Smartlog, transactionIdArg: string) {\n this.smartlogRef = smartlogInstance;\n this.transactionId = transactionIdArg;\n }\n\n public log(\n logLevelArg: plugins.smartlogInterfaces.TLogLevel,\n logMessageArg: string,\n logDataArg?: any,\n ) {\n this.smartlogRef.log(logLevelArg, logMessageArg, logDataArg, {\n id: plugins.isounique.uni(),\n type: 'none',\n group: this.groupId,\n instance: this.smartlogRef.uniInstanceId,\n transaction: this.transactionId,\n });\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,QAAM,MAAM,CAAC,SAAiB,UAAS;AAC5C,aAAO,GAAG,MAAM,IAAI,2BAA2B,QAAQ,SAAS,CAAC,MAAK;AACpE,cAAM,IAAK,KAAK,OAAM,IAAK,KAAM;AACjC,cAAM,IAAI,MAAM,MAAM,IAAK,IAAI,IAAO;AACtC,eAAO,EAAE,SAAS,EAAE;MACtB,CAAC,CAAC;IACJ;AANa,YAAA,MAAG;;;;;ACAhB;;;;;;ACAA;;;ACAA,IAAAA,mBAAA;SAAAA,kBAAA;;;;;;;;;;;;;;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACIC;;;ACJD;;;ACAA;;;ACAA;;;;;;ACEM,IAAO,mBAAP,MAAuB;;;;ACF7B;;;ACAA;;;ACAA;;;ACAA;;;ACAA,gBAA2B;;;ACKpB,IAAM,aAAN,MAAiB;AAAA,EACf,IACL,aACA,eACA,SACA,gBACA;AACA,YAAQ,IAAI,OAAO,WAAW,KAAK,aAAa,EAAE;AAAA,EACpD;AACF;;;ACZO,IAAM,YAAN,MAAgB;AAAA,EAMrB,cAAc;AAFd;AAAA;AAA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O;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AAAA,EAEA,MAAa,UAAU,eAAuD;AAC5E,UAAM,KAAK,UAAU,SAAS,aAAa;AAAA,EAC7C;AAAA,EAEQ,eAAe,SAAiB;AACtC,YAAQ;AAAA,MACN,WAAU,oBAAI,KAAK,GAAE,SAAS,CAAC,KAAI,oBAAI,KAAK,GAAE,WAAW,CAAC,KAAI,oBAAI,KAAK,GAAE,WAAW,CAAC,OAAO,OAAO;AAAA,IACrG;AAAA,EACF;AAAA,EAEO,eAAe,gBAAwB,QAAQ;AACpD,WAAO,IAAI,SAAS,MAAM,aAAa;AAAA,EACzC;AACF;;;AChKO,IAAM,WAAN,MAAe;AAAA,EAKpB,YAAY,kBAA4B,kBAA0B;AAFlE,SAAO,UAAkB,UAAU,IAAI;AAGrC,SAAK,cAAc;AACnB,SAAK,gBAAgB;AAAA,EACvB;AAAA,EAEO,IACL,aACA,eACA,YACA;AACA,SAAK,YAAY,IAAI,aAAa,eAAe,YAAY;AAAA,MAC3D,IAAY,UAAU,IAAI;AAAA,MAC1B,MAAM;AAAA,MACN,OAAO,KAAK;AAAA,MACZ,UAAU,KAAK,YAAY;AAAA,MAC3B,aAAa,KAAK;AAAA,IACpB,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": ["dist_ts_exports"]
|
|
7
7
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartlog',
|
|
6
|
-
version: '3.1.
|
|
6
|
+
version: '3.1.10',
|
|
7
7
|
description: 'A minimalistic, distributed, and extensible logging tool supporting centralized log management.'
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxzQkFBc0I7SUFDNUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLGlHQUFpRztDQUMvRyxDQUFBIn0=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@push.rocks/smartlog",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A minimalistic, distributed, and extensible logging tool supporting centralized log management.",
|
|
6
6
|
"keywords": [
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
"author": "Lossless GmbH",
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@git.zone/tsbuild": "^2.
|
|
40
|
-
"@git.zone/tsbundle": "^2.
|
|
39
|
+
"@git.zone/tsbuild": "^2.6.8",
|
|
40
|
+
"@git.zone/tsbundle": "^2.5.1",
|
|
41
41
|
"@git.zone/tsrun": "^1.3.3",
|
|
42
|
-
"@git.zone/tstest": "^
|
|
42
|
+
"@git.zone/tstest": "^2.3.6",
|
|
43
43
|
"@types/node": "^22.15.20"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@api.global/typedrequest-interfaces": "^3.0.19",
|
|
47
|
-
"@push.rocks/consolecolor": "^2.0.
|
|
47
|
+
"@push.rocks/consolecolor": "^2.0.3",
|
|
48
48
|
"@push.rocks/isounique": "^1.0.4",
|
|
49
49
|
"@push.rocks/smartclickhouse": "^2.0.17",
|
|
50
|
-
"@push.rocks/smartfile": "^11.2.
|
|
51
|
-
"@push.rocks/smarthash": "^3.
|
|
50
|
+
"@push.rocks/smartfile": "^11.2.7",
|
|
51
|
+
"@push.rocks/smarthash": "^3.2.3",
|
|
52
52
|
"@push.rocks/smartpromise": "^4.2.3",
|
|
53
53
|
"@push.rocks/smarttime": "^4.1.1",
|
|
54
54
|
"@push.rocks/webrequest": "^3.0.37",
|