@push.rocks/smartlog 3.0.6 → 3.0.8

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.
Files changed (70) hide show
  1. package/dist_bundle/bundle.js +9 -1
  2. package/dist_bundle/bundle.js.map +2 -2
  3. package/dist_ts/00_commitinfo_data.d.ts +1 -1
  4. package/dist_ts/00_commitinfo_data.js +2 -2
  5. package/dist_ts/smartlog.classes.smartlog.d.ts +1 -0
  6. package/dist_ts/smartlog.classes.smartlog.js +9 -1
  7. package/dist_ts/smartlog.plugins.d.ts +1 -1
  8. package/dist_ts/smartlog.plugins.js +2 -2
  9. package/dist_ts_context/index.d.ts +1 -0
  10. package/dist_ts_context/index.js +3 -0
  11. package/dist_ts_context/smartlog-context.plugins.d.ts +2 -0
  12. package/dist_ts_context/smartlog-context.plugins.js +4 -0
  13. package/dist_ts_destination_clickhouse/00_commitinfo_data.d.ts +8 -0
  14. package/dist_ts_destination_clickhouse/00_commitinfo_data.js +9 -0
  15. package/dist_ts_destination_clickhouse/index.d.ts +9 -0
  16. package/dist_ts_destination_clickhouse/index.js +20 -0
  17. package/dist_ts_destination_clickhouse/slclick.plugins.d.ts +3 -0
  18. package/dist_ts_destination_clickhouse/slclick.plugins.js +5 -0
  19. package/dist_ts_destination_devtools/00_commitinfo_data.d.ts +8 -0
  20. package/dist_ts_destination_devtools/00_commitinfo_data.js +9 -0
  21. package/dist_ts_destination_devtools/index.d.ts +5 -0
  22. package/dist_ts_destination_devtools/index.js +32 -0
  23. package/dist_ts_destination_devtools/plugins.d.ts +2 -0
  24. package/dist_ts_destination_devtools/plugins.js +3 -0
  25. package/dist_ts_destination_file/index.d.ts +6 -0
  26. package/dist_ts_destination_file/index.js +17 -0
  27. package/dist_ts_destination_file/smartfile-destination-file.plugins.d.ts +7 -0
  28. package/dist_ts_destination_file/smartfile-destination-file.plugins.js +10 -0
  29. package/dist_ts_destination_local/00_commitinfo_data.d.ts +8 -0
  30. package/dist_ts_destination_local/00_commitinfo_data.js +9 -0
  31. package/dist_ts_destination_local/classes.destinationlocal.d.ts +22 -0
  32. package/dist_ts_destination_local/classes.destinationlocal.js +115 -0
  33. package/dist_ts_destination_local/index.d.ts +1 -0
  34. package/dist_ts_destination_local/index.js +3 -0
  35. package/dist_ts_destination_local/plugins.d.ts +4 -0
  36. package/dist_ts_destination_local/plugins.js +5 -0
  37. package/dist_ts_destination_receiver/00_commitinfo_data.d.ts +8 -0
  38. package/dist_ts_destination_receiver/00_commitinfo_data.js +9 -0
  39. package/dist_ts_destination_receiver/index.d.ts +12 -0
  40. package/dist_ts_destination_receiver/index.js +23 -0
  41. package/dist_ts_destination_receiver/smartlog-destination-receiver.plugins.d.ts +4 -0
  42. package/dist_ts_destination_receiver/smartlog-destination-receiver.plugins.js +5 -0
  43. package/dist_ts_interfaces/00_commitinfo_data.d.ts +8 -0
  44. package/dist_ts_interfaces/00_commitinfo_data.js +9 -0
  45. package/dist_ts_interfaces/index.d.ts +96 -0
  46. package/dist_ts_interfaces/index.js +4 -0
  47. package/dist_ts_interfaces/smartlog-interfaces.plugins.d.ts +4 -0
  48. package/dist_ts_interfaces/smartlog-interfaces.plugins.js +6 -0
  49. package/dist_ts_interfaces/smartlog-interfaces.requests.d.ts +8 -0
  50. package/dist_ts_interfaces/smartlog-interfaces.requests.js +2 -0
  51. package/dist_ts_receiver/00_commitinfo_data.d.ts +8 -0
  52. package/dist_ts_receiver/00_commitinfo_data.js +9 -0
  53. package/dist_ts_receiver/index.d.ts +1 -0
  54. package/dist_ts_receiver/index.js +2 -0
  55. package/dist_ts_receiver/sl.classes.smartlogreceiver.d.ts +28 -0
  56. package/dist_ts_receiver/sl.classes.smartlogreceiver.js +48 -0
  57. package/dist_ts_receiver/sl.receiver.plugins.d.ts +3 -0
  58. package/dist_ts_receiver/sl.receiver.plugins.js +4 -0
  59. package/dist_ts_source_ora/index.d.ts +11 -0
  60. package/dist_ts_source_ora/index.js +34 -0
  61. package/dist_ts_source_ora/smartlog-source-ora.plugins.d.ts +4 -0
  62. package/dist_ts_source_ora/smartlog-source-ora.plugins.js +7 -0
  63. package/package.json +40 -11
  64. package/readme.md +8 -4
  65. package/readme.plan.md +0 -0
  66. package/ts/00_commitinfo_data.ts +2 -2
  67. package/ts/smartlog.classes.consolelog.ts +1 -1
  68. package/ts/smartlog.classes.loggroup.ts +1 -1
  69. package/ts/smartlog.classes.smartlog.ts +15 -3
  70. package/ts/smartlog.plugins.ts +1 -1
@@ -0,0 +1,23 @@
1
+ import * as plugins from './smartlog-destination-receiver.plugins.js';
2
+ import {} from '../dist_ts_interfaces/index.js';
3
+ export class SmartlogDestinationReceiver {
4
+ constructor(optionsArg) {
5
+ this.webrequest = new plugins.webrequest.WebRequest();
6
+ this.errorCounter = 0;
7
+ this.options = optionsArg;
8
+ }
9
+ async handleLog(logPackageArg) {
10
+ const response = await this.webrequest.postJson(this.options.receiverEndpoint, {
11
+ auth: plugins.smarthash.sha256FromStringSync(this.options.passphrase),
12
+ logPackage: logPackageArg,
13
+ }).catch(err => {
14
+ if (this.errorCounter % 100 === 0) {
15
+ console.error(`There seems to be an error with logging.`);
16
+ console.error(`Accumulated ${this.errorCounter} errors so far`);
17
+ }
18
+ this.errorCounter++;
19
+ });
20
+ return response.body;
21
+ }
22
+ }
23
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c19kZXN0aW5hdGlvbl9yZWNlaXZlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLDRDQUE0QyxDQUFDO0FBQ3RFLE9BQU8sRUFJTixNQUFNLGdDQUFnQyxDQUFDO0FBT3hDLE1BQU0sT0FBTywyQkFBMkI7SUFJdEMsWUFBWSxVQUEwRDtRQUY5RCxlQUFVLEdBQUcsSUFBSSxPQUFPLENBQUMsVUFBVSxDQUFDLFVBQVUsRUFBRSxDQUFDO1FBTWpELGlCQUFZLEdBQUcsQ0FBQyxDQUFDO1FBSHZCLElBQUksQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDO0lBQzVCLENBQUM7SUFHTSxLQUFLLENBQUMsU0FBUyxDQUFDLGFBQTBCO1FBQy9DLE1BQU0sUUFBUSxHQUFHLE1BQU0sSUFBSSxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxnQkFBZ0IsRUFBRTtZQUM3RSxJQUFJLEVBQUUsT0FBTyxDQUFDLFNBQVMsQ0FBQyxvQkFBb0IsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQztZQUNyRSxVQUFVLEVBQUUsYUFBYTtTQUMxQixDQUFDLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxFQUFFO1lBQ2IsSUFBSSxJQUFJLENBQUMsWUFBWSxHQUFHLEdBQUcsS0FBSyxDQUFDLEVBQUUsQ0FBQztnQkFDbEMsT0FBTyxDQUFDLEtBQUssQ0FBQywwQ0FBMEMsQ0FBQyxDQUFDO2dCQUMxRCxPQUFPLENBQUMsS0FBSyxDQUFDLGVBQWUsSUFBSSxDQUFDLFlBQVksZ0JBQWdCLENBQUMsQ0FBQTtZQUNqRSxDQUFDO1lBQ0QsSUFBSSxDQUFDLFlBQVksRUFBRSxDQUFDO1FBQ3RCLENBQUMsQ0FBQyxDQUFDO1FBQ0gsT0FBTyxRQUFRLENBQUMsSUFBSSxDQUFDO0lBQ3ZCLENBQUM7Q0FDRiJ9
@@ -0,0 +1,4 @@
1
+ import * as smarthash from '@push.rocks/smarthash';
2
+ import * as smartlogInterfaces from '../dist_ts_interfaces/index.js';
3
+ import * as webrequest from '@push.rocks/webrequest';
4
+ export { smarthash, smartlogInterfaces, webrequest };
@@ -0,0 +1,5 @@
1
+ import * as smarthash from '@push.rocks/smarthash';
2
+ import * as smartlogInterfaces from '../dist_ts_interfaces/index.js';
3
+ import * as webrequest from '@push.rocks/webrequest';
4
+ export { smarthash, smartlogInterfaces, webrequest };
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRsb2ctZGVzdGluYXRpb24tcmVjZWl2ZXIucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzX2Rlc3RpbmF0aW9uX3JlY2VpdmVyL3NtYXJ0bG9nLWRlc3RpbmF0aW9uLXJlY2VpdmVyLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLFNBQVMsTUFBTSx1QkFBdUIsQ0FBQztBQUNuRCxPQUFPLEtBQUssa0JBQWtCLE1BQU0sZ0NBQWdDLENBQUM7QUFDckUsT0FBTyxLQUFLLFVBQVUsTUFBTSx3QkFBd0IsQ0FBQztBQUVyRCxPQUFPLEVBQUUsU0FBUyxFQUFFLGtCQUFrQixFQUFFLFVBQVUsRUFBRSxDQUFDIn0=
@@ -0,0 +1,8 @@
1
+ /**
2
+ * autocreated commitinfo by @push.rocks/commitinfo
3
+ */
4
+ export declare const commitinfo: {
5
+ name: string;
6
+ version: string;
7
+ description: string;
8
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * autocreated commitinfo by @push.rocks/commitinfo
3
+ */
4
+ export const commitinfo = {
5
+ name: '@push.rocks/smartlog-interfaces',
6
+ version: '3.0.2',
7
+ description: 'Defines interfaces for the smartlog ecosystem.'
8
+ };
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfaW50ZXJmYWNlcy8wMF9jb21taXRpbmZvX2RhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFDSCxNQUFNLENBQUMsTUFBTSxVQUFVLEdBQUc7SUFDeEIsSUFBSSxFQUFFLGlDQUFpQztJQUN2QyxPQUFPLEVBQUUsT0FBTztJQUNoQixXQUFXLEVBQUUsZ0RBQWdEO0NBQzlELENBQUEifQ==
@@ -0,0 +1,96 @@
1
+ import * as plugins from './smartlog-interfaces.plugins.js';
2
+ import * as requestInterfaces from './smartlog-interfaces.requests.js';
3
+ export { requestInterfaces as request };
4
+ /**
5
+ * the different available log types
6
+ */
7
+ export type TLogType = 'log' | 'increment' | 'gauge' | 'error' | 'success' | 'value' | 'finance' | 'compliance';
8
+ /**
9
+ * the available log levels
10
+ */
11
+ export type TLogLevel = 'silly' | 'info' | 'debug' | 'note' | 'ok' | 'success' | 'warn' | 'error' | 'lifecycle';
12
+ /**
13
+ * the available environments
14
+ */
15
+ export type TEnvironment = 'local' | 'test' | 'staging' | 'production';
16
+ /**
17
+ * the available runtimes
18
+ */
19
+ export type TRuntime = 'node' | 'chrome' | 'rust' | 'deno' | 'cloudflare_workers';
20
+ /**
21
+ * the log context e.g. what app in what version on what server
22
+ */
23
+ export interface ILogContext {
24
+ commitinfo?: plugins.tsclass.code.ICommitInfo;
25
+ company?: string;
26
+ companyunit?: string;
27
+ containerName?: string;
28
+ environment?: TEnvironment;
29
+ runtime?: TRuntime;
30
+ zone?: string;
31
+ }
32
+ export interface ILogCorrelation {
33
+ /**
34
+ * a unique id for this log
35
+ */
36
+ id: string;
37
+ /**
38
+ * the type of this log
39
+ */
40
+ type: 'none' | 'service' | 'build' | 'infrastructure' | 'cdn';
41
+ /**
42
+ * the instance on which the log is created
43
+ * use it for pinning logs to a certain instance in a cluster
44
+ */
45
+ instance?: string;
46
+ /**
47
+ * a series of logs
48
+ */
49
+ group?: string;
50
+ /**
51
+ * a log that belongs to a transaction. E.g. a Payment or a request traveling through multiple backend instances
52
+ */
53
+ transaction?: string;
54
+ }
55
+ /**
56
+ * the main logpackage
57
+ */
58
+ export interface ILogPackage<T = unknown> {
59
+ /**
60
+ * a unix timestamp in milliseconds
61
+ */
62
+ timestamp: number;
63
+ type: TLogType;
64
+ context: ILogContext;
65
+ level: TLogLevel;
66
+ /**
67
+ * allows grouping of log messages
68
+ */
69
+ correlation: ILogCorrelation;
70
+ /**
71
+ * the message to log
72
+ */
73
+ message: string;
74
+ data?: T;
75
+ }
76
+ export interface ILogPackageDataRequest {
77
+ requestCorrelationId: string;
78
+ url: string;
79
+ pathname: string;
80
+ method: string;
81
+ status: string;
82
+ }
83
+ export interface ILogPackageAuthenticated {
84
+ auth: string;
85
+ logPackage: ILogPackage;
86
+ }
87
+ export interface ILogPackageArrayAuthenticated {
88
+ auth: string;
89
+ logPackages: ILogPackage[];
90
+ }
91
+ /**
92
+ * a destination interface for extending smartlog modules
93
+ */
94
+ export interface ILogDestination {
95
+ handleLog: (logPackage: ILogPackage) => Promise<void>;
96
+ }
@@ -0,0 +1,4 @@
1
+ import * as plugins from './smartlog-interfaces.plugins.js';
2
+ import * as requestInterfaces from './smartlog-interfaces.requests.js';
3
+ export { requestInterfaces as request };
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c19pbnRlcmZhY2VzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sa0NBQWtDLENBQUM7QUFFNUQsT0FBTyxLQUFLLGlCQUFpQixNQUFNLG1DQUFtQyxDQUFDO0FBRXZFLE9BQU8sRUFBRSxpQkFBaUIsSUFBSSxPQUFPLEVBQUUsQ0FBQyJ9
@@ -0,0 +1,4 @@
1
+ import * as typedrequestInterfaces from '@api.global/typedrequest-interfaces';
2
+ export { typedrequestInterfaces };
3
+ import * as tsclass from '@tsclass/tsclass';
4
+ export { tsclass };
@@ -0,0 +1,6 @@
1
+ import * as typedrequestInterfaces from '@api.global/typedrequest-interfaces';
2
+ export { typedrequestInterfaces };
3
+ // tsclass scope
4
+ import * as tsclass from '@tsclass/tsclass';
5
+ export { tsclass };
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRsb2ctaW50ZXJmYWNlcy5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfaW50ZXJmYWNlcy9zbWFydGxvZy1pbnRlcmZhY2VzLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLHNCQUFzQixNQUFNLHFDQUFxQyxDQUFDO0FBRTlFLE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxDQUFDO0FBRWxDLGdCQUFnQjtBQUNoQixPQUFPLEtBQUssT0FBTyxNQUFNLGtCQUFrQixDQUFDO0FBRTVDLE9BQU8sRUFDTCxPQUFPLEVBQ1IsQ0FBQSJ9
@@ -0,0 +1,8 @@
1
+ import { type ILogPackageAuthenticated } from './index.js';
2
+ export interface IRequest_SmartlogDestinationReceiver_Any_PostLogPackages {
3
+ method: 'postLogPackages';
4
+ request: {
5
+ logPackages: ILogPackageAuthenticated[];
6
+ };
7
+ response: {};
8
+ }
@@ -0,0 +1,2 @@
1
+ import {} from './index.js';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRsb2ctaW50ZXJmYWNlcy5yZXF1ZXN0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzX2ludGVyZmFjZXMvc21hcnRsb2ctaW50ZXJmYWNlcy5yZXF1ZXN0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQWlDLE1BQU0sWUFBWSxDQUFDIn0=
@@ -0,0 +1,8 @@
1
+ /**
2
+ * autocreated commitinfo by @push.rocks/commitinfo
3
+ */
4
+ export declare const commitinfo: {
5
+ name: string;
6
+ version: string;
7
+ description: string;
8
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * autocreated commitinfo by @push.rocks/commitinfo
3
+ */
4
+ export const commitinfo = {
5
+ name: '@push.rocks/smartlog-receiver',
6
+ version: '2.0.0',
7
+ description: 'a receiver for smartlog-destination-receiver'
8
+ };
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfcmVjZWl2ZXIvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSwrQkFBK0I7SUFDckMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLDhDQUE4QztDQUM1RCxDQUFBIn0=
@@ -0,0 +1 @@
1
+ export * from './sl.classes.smartlogreceiver.js';
@@ -0,0 +1,2 @@
1
+ export * from './sl.classes.smartlogreceiver.js';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c19yZWNlaXZlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGtDQUFrQyxDQUFDIn0=
@@ -0,0 +1,28 @@
1
+ import * as plugins from './sl.receiver.plugins.js';
2
+ import type { ILogPackage, ILogPackageAuthenticated } from '../dist_ts_interfaces/index.js';
3
+ export type TValidatorFunction = (logPackage: ILogPackage) => Promise<boolean>;
4
+ export interface ISmartlogReceiverOptions {
5
+ smartlogInstance: plugins.smartlog.Smartlog;
6
+ passphrase: string;
7
+ validatorFunction: TValidatorFunction;
8
+ }
9
+ /**
10
+ * a class that receives smartlog packages
11
+ */
12
+ export declare class SmartlogReceiver {
13
+ passphrase: string;
14
+ validatorFunction: TValidatorFunction;
15
+ smartlogInstance: plugins.smartlog.Smartlog;
16
+ constructor(smartlogReceiverOptions: ISmartlogReceiverOptions);
17
+ /**
18
+ * handles a authenticated log
19
+ */
20
+ handleAuthenticatedLog(authenticatedLogPackageArg: ILogPackageAuthenticated): Promise<{
21
+ status: string;
22
+ }>;
23
+ /**
24
+ * handles an array of authenticated logs
25
+ * @param authenticatedLogsPackageArrayArg
26
+ */
27
+ handleManyAuthenticatedLogs(authenticatedLogsPackageArrayArg: ILogPackageAuthenticated[]): Promise<void>;
28
+ }
@@ -0,0 +1,48 @@
1
+ import * as plugins from './sl.receiver.plugins.js';
2
+ /**
3
+ * a class that receives smartlog packages
4
+ */
5
+ export class SmartlogReceiver {
6
+ constructor(smartlogReceiverOptions) {
7
+ this.passphrase = smartlogReceiverOptions.passphrase;
8
+ this.validatorFunction =
9
+ smartlogReceiverOptions.validatorFunction ||
10
+ (async (logpackageArg) => {
11
+ return true;
12
+ });
13
+ this.smartlogInstance = smartlogReceiverOptions.smartlogInstance;
14
+ }
15
+ /**
16
+ * handles a authenticated log
17
+ */
18
+ async handleAuthenticatedLog(authenticatedLogPackageArg) {
19
+ const authString = authenticatedLogPackageArg.auth;
20
+ const logPackage = authenticatedLogPackageArg.logPackage;
21
+ if (authString === plugins.smarthash.sha256FromStringSync(this.passphrase) &&
22
+ (await this.validatorFunction(logPackage))) {
23
+ // Message authenticated lets clean up.
24
+ logPackage.correlation ? null : (logPackage.correlation = { id: '123', type: 'none' });
25
+ logPackage.correlation.id ? null : (logPackage.correlation.id = '123');
26
+ logPackage.correlation.type ? null : (logPackage.correlation.type = 'none');
27
+ this.smartlogInstance.handleLog(logPackage);
28
+ return { status: 'ok' };
29
+ }
30
+ else {
31
+ this.smartlogInstance.log('error', 'Message rejected because of bad passphrase');
32
+ return { status: 'error' };
33
+ // console.log(plugins.smarthash.sha256FromStringSync(this.passphrase));
34
+ }
35
+ }
36
+ /**
37
+ * handles an array of authenticated logs
38
+ * @param authenticatedLogsPackageArrayArg
39
+ */
40
+ async handleManyAuthenticatedLogs(authenticatedLogsPackageArrayArg) {
41
+ const promiseArray = [];
42
+ for (const logPackage of authenticatedLogsPackageArrayArg) {
43
+ promiseArray.push(this.handleAuthenticatedLog(logPackage));
44
+ }
45
+ await Promise.all(promiseArray);
46
+ }
47
+ }
48
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2wuY2xhc3Nlcy5zbWFydGxvZ3JlY2VpdmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfcmVjZWl2ZXIvc2wuY2xhc3Nlcy5zbWFydGxvZ3JlY2VpdmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sMEJBQTBCLENBQUM7QUFnQnBEOztHQUVHO0FBQ0gsTUFBTSxPQUFPLGdCQUFnQjtJQUszQixZQUFZLHVCQUFpRDtRQUMzRCxJQUFJLENBQUMsVUFBVSxHQUFHLHVCQUF1QixDQUFDLFVBQVUsQ0FBQztRQUNyRCxJQUFJLENBQUMsaUJBQWlCO1lBQ3BCLHVCQUF1QixDQUFDLGlCQUFpQjtnQkFDekMsQ0FBQyxLQUFLLEVBQUUsYUFBYSxFQUFFLEVBQUU7b0JBQ3ZCLE9BQU8sSUFBSSxDQUFDO2dCQUNkLENBQUMsQ0FBQyxDQUFDO1FBQ0wsSUFBSSxDQUFDLGdCQUFnQixHQUFHLHVCQUF1QixDQUFDLGdCQUFnQixDQUFDO0lBQ25FLENBQUM7SUFFRDs7T0FFRztJQUNJLEtBQUssQ0FBQyxzQkFBc0IsQ0FBQywwQkFBb0Q7UUFDdEYsTUFBTSxVQUFVLEdBQUcsMEJBQTBCLENBQUMsSUFBSSxDQUFDO1FBQ25ELE1BQU0sVUFBVSxHQUFHLDBCQUEwQixDQUFDLFVBQVUsQ0FBQztRQUV6RCxJQUNFLFVBQVUsS0FBSyxPQUFPLENBQUMsU0FBUyxDQUFDLG9CQUFvQixDQUFDLElBQUksQ0FBQyxVQUFVLENBQUM7WUFDdEUsQ0FBQyxNQUFNLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxVQUFVLENBQUMsQ0FBQyxFQUMxQyxDQUFDO1lBQ0QsdUNBQXVDO1lBQ3ZDLFVBQVUsQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQUMsV0FBVyxHQUFHLEVBQUUsRUFBRSxFQUFFLEtBQUssRUFBRSxJQUFJLEVBQUUsTUFBTSxFQUFFLENBQUMsQ0FBQztZQUN2RixVQUFVLENBQUMsV0FBVyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxXQUFXLENBQUMsRUFBRSxHQUFHLEtBQUssQ0FBQyxDQUFDO1lBQ3ZFLFVBQVUsQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxJQUFJLEdBQUcsTUFBTSxDQUFDLENBQUM7WUFFNUUsSUFBSSxDQUFDLGdCQUFnQixDQUFDLFNBQVMsQ0FBQyxVQUFVLENBQUMsQ0FBQztZQUM1QyxPQUFPLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRSxDQUFDO1FBQzFCLENBQUM7YUFBTSxDQUFDO1lBQ04sSUFBSSxDQUFDLGdCQUFnQixDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsNENBQTRDLENBQUMsQ0FBQztZQUNqRixPQUFPLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxDQUFDO1lBQzNCLHdFQUF3RTtRQUMxRSxDQUFDO0lBQ0gsQ0FBQztJQUVEOzs7T0FHRztJQUNJLEtBQUssQ0FBQywyQkFBMkIsQ0FDdEMsZ0NBQTREO1FBRTVELE1BQU0sWUFBWSxHQUF3QixFQUFFLENBQUM7UUFDN0MsS0FBSyxNQUFNLFVBQVUsSUFBSSxnQ0FBZ0MsRUFBRSxDQUFDO1lBQzFELFlBQVksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLHNCQUFzQixDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUM7UUFDN0QsQ0FBQztRQUNELE1BQU0sT0FBTyxDQUFDLEdBQUcsQ0FBQyxZQUFZLENBQUMsQ0FBQztJQUNsQyxDQUFDO0NBQ0YifQ==
@@ -0,0 +1,3 @@
1
+ import * as smarthash from '@push.rocks/smarthash';
2
+ import * as smartlog from '../dist_ts/index.js';
3
+ export { smartlog, smarthash };
@@ -0,0 +1,4 @@
1
+ import * as smarthash from '@push.rocks/smarthash';
2
+ import * as smartlog from '../dist_ts/index.js';
3
+ export { smartlog, smarthash };
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2wucmVjZWl2ZXIucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzX3JlY2VpdmVyL3NsLnJlY2VpdmVyLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLFNBQVMsTUFBTSx1QkFBdUIsQ0FBQztBQUNuRCxPQUFPLEtBQUssUUFBUSxNQUFNLHFCQUFxQixDQUFDO0FBRWhELE9BQU8sRUFBRSxRQUFRLEVBQUUsU0FBUyxFQUFFLENBQUMifQ==
@@ -0,0 +1,11 @@
1
+ export declare class SmartlogSourceOra {
2
+ oraInstance: import("ora").Ora;
3
+ started: boolean;
4
+ constructor();
5
+ text(textArg: string): void;
6
+ stop(): void;
7
+ finishSuccess(textArg?: string): void;
8
+ finishFail(textArg?: string): void;
9
+ successAndNext(textArg: string): void;
10
+ failAndNext(textArg: string): void;
11
+ }
@@ -0,0 +1,34 @@
1
+ import * as plugins from './smartlog-source-ora.plugins.js';
2
+ export class SmartlogSourceOra {
3
+ constructor() {
4
+ this.oraInstance = plugins.ora('loading');
5
+ this.started = false;
6
+ }
7
+ text(textArg) {
8
+ this.oraInstance.text = textArg;
9
+ if (!this.started) {
10
+ this.started = true;
11
+ this.oraInstance.start();
12
+ }
13
+ }
14
+ stop() {
15
+ this.oraInstance.stop();
16
+ }
17
+ finishSuccess(textArg) {
18
+ this.oraInstance.succeed(textArg);
19
+ this.started = false;
20
+ }
21
+ finishFail(textArg) {
22
+ this.oraInstance.fail(textArg);
23
+ this.started = false;
24
+ }
25
+ successAndNext(textArg) {
26
+ this.finishSuccess();
27
+ this.text(textArg);
28
+ }
29
+ failAndNext(textArg) {
30
+ this.finishFail();
31
+ this.text(textArg);
32
+ }
33
+ }
34
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c19zb3VyY2Vfb3JhL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sa0NBQWtDLENBQUM7QUFFNUQsTUFBTSxPQUFPLGlCQUFpQjtJQUk1QjtRQUhPLGdCQUFXLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxTQUFTLENBQUMsQ0FBQztRQUNyQyxZQUFPLEdBQUcsS0FBSyxDQUFDO0lBRVIsQ0FBQztJQUVULElBQUksQ0FBQyxPQUFlO1FBQ3pCLElBQUksQ0FBQyxXQUFXLENBQUMsSUFBSSxHQUFHLE9BQU8sQ0FBQztRQUNoQyxJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO1lBQ2xCLElBQUksQ0FBQyxPQUFPLEdBQUcsSUFBSSxDQUFDO1lBQ3BCLElBQUksQ0FBQyxXQUFXLENBQUMsS0FBSyxFQUFFLENBQUM7UUFDM0IsQ0FBQztJQUNILENBQUM7SUFFTSxJQUFJO1FBQ1QsSUFBSSxDQUFDLFdBQVcsQ0FBQyxJQUFJLEVBQUUsQ0FBQztJQUMxQixDQUFDO0lBRU0sYUFBYSxDQUFDLE9BQWdCO1FBQ25DLElBQUksQ0FBQyxXQUFXLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQ2xDLElBQUksQ0FBQyxPQUFPLEdBQUcsS0FBSyxDQUFDO0lBQ3ZCLENBQUM7SUFFTSxVQUFVLENBQUMsT0FBZ0I7UUFDaEMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDL0IsSUFBSSxDQUFDLE9BQU8sR0FBRyxLQUFLLENBQUM7SUFDdkIsQ0FBQztJQUVNLGNBQWMsQ0FBQyxPQUFlO1FBQ25DLElBQUksQ0FBQyxhQUFhLEVBQUUsQ0FBQztRQUNyQixJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ3JCLENBQUM7SUFFTSxXQUFXLENBQUMsT0FBZTtRQUNoQyxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUM7UUFDbEIsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUNyQixDQUFDO0NBQ0YifQ==
@@ -0,0 +1,4 @@
1
+ import * as smartlogInterfaces from '../dist_ts_interfaces/index.js';
2
+ export { smartlogInterfaces };
3
+ import ora from 'ora';
4
+ export { ora };
@@ -0,0 +1,7 @@
1
+ // pushrocks scope
2
+ import * as smartlogInterfaces from '../dist_ts_interfaces/index.js';
3
+ export { smartlogInterfaces };
4
+ // third party scope
5
+ import ora from 'ora';
6
+ export { ora };
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRsb2ctc291cmNlLW9yYS5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfc291cmNlX29yYS9zbWFydGxvZy1zb3VyY2Utb3JhLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsa0JBQWtCO0FBQ2xCLE9BQU8sS0FBSyxrQkFBa0IsTUFBTSxnQ0FBZ0MsQ0FBQztBQUVyRSxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsQ0FBQztBQUU5QixvQkFBb0I7QUFDcEIsT0FBTyxHQUFHLE1BQU0sS0FBSyxDQUFDO0FBRXRCLE9BQU8sRUFBRSxHQUFHLEVBQUUsQ0FBQyJ9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@push.rocks/smartlog",
3
- "version": "3.0.6",
3
+ "version": "3.0.8",
4
4
  "private": false,
5
5
  "description": "A minimalistic, distributed, and extensible logging tool supporting centralized log management.",
6
6
  "keywords": [
@@ -19,21 +19,42 @@
19
19
  "error tracking",
20
20
  "development tools"
21
21
  ],
22
- "main": "dist_ts/index.js",
23
- "typings": "dist_ts/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "import": "./dist_ts/index.js"
25
+ },
26
+ "./context": "./dist_ts_context/index.js",
27
+ "./interfaces": "./dist_ts_interfaces/index.js",
28
+ "./source-ora": "./dist_ts_source_ora/index.js",
29
+ "./destination-clickhouse": "./dist_ts_destination_clickhouse/index.js",
30
+ "./destination-devtools": "./dist_ts_destination_devtools/index.js",
31
+ "./destination-file": "./dist_ts_destination_file/index.js",
32
+ "./destination-local": "./dist_ts_destination_local/index.js",
33
+ "./destination-receiver": "./dist_ts_destination_receiver/index.js",
34
+ "./receiver": "./dist_ts_receiver/index.js"
35
+ },
24
36
  "author": "Lossless GmbH",
25
37
  "license": "MIT",
26
38
  "devDependencies": {
27
- "@git.zone/tsbuild": "^2.1.66",
28
- "@git.zone/tsbundle": "^2.0.8",
29
- "@git.zone/tsrun": "^1.2.44",
30
- "@git.zone/tstest": "^1.0.77",
31
- "@push.rocks/tapbundle": "^5.0.23",
32
- "@types/node": "^20.12.12"
39
+ "@git.zone/tsbuild": "^2.3.2",
40
+ "@git.zone/tsbundle": "^2.2.5",
41
+ "@git.zone/tsrun": "^1.3.3",
42
+ "@git.zone/tstest": "^1.0.96",
43
+ "@push.rocks/tapbundle": "^6.0.3",
44
+ "@types/node": "^22.15.17"
33
45
  },
34
46
  "dependencies": {
47
+ "@api.global/typedrequest-interfaces": "^3.0.19",
48
+ "@push.rocks/consolecolor": "^2.0.2",
35
49
  "@push.rocks/isounique": "^1.0.4",
36
- "@push.rocks/smartlog-interfaces": "^3.0.0"
50
+ "@push.rocks/smartclickhouse": "^2.0.17",
51
+ "@push.rocks/smartfile": "^11.2.0",
52
+ "@push.rocks/smarthash": "^3.0.4",
53
+ "@push.rocks/smartpromise": "^4.2.3",
54
+ "@push.rocks/smarttime": "^4.1.1",
55
+ "@push.rocks/webrequest": "^3.0.37",
56
+ "@tsclass/tsclass": "^9.2.0",
57
+ "ora": "^8.2.0"
37
58
  },
38
59
  "files": [
39
60
  "ts/**/*",
@@ -51,9 +72,17 @@
51
72
  "last 1 chrome versions"
52
73
  ],
53
74
  "type": "module",
75
+ "homepage": "https://code.foss.global/push.rocks/smartlog#readme",
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "https://code.foss.global/push.rocks/smartlog.git"
79
+ },
80
+ "bugs": {
81
+ "url": "https://code.foss.global/push.rocks/smartlog/issues"
82
+ },
54
83
  "scripts": {
55
84
  "test": "(tstest test/)",
56
- "build": "(tsbuild --web && tsbundle npm)",
85
+ "build": "(tsbuild tsfolders --allowimplicitany && tsbundle npm)",
57
86
  "format": "(gitzone format)",
58
87
  "buildDocs": "tsdoc"
59
88
  }
package/readme.md CHANGED
@@ -30,8 +30,8 @@ const logger = new Smartlog({
30
30
  containerName: 'awesome-container',
31
31
  environment: 'kubernetes-production',
32
32
  runtime: 'node',
33
- zone: 'zone x'
34
- }
33
+ zone: 'zone x',
34
+ },
35
35
  });
36
36
  ```
37
37
 
@@ -76,7 +76,11 @@ class MyCustomLogDestination implements ILogDestination {
76
76
  }
77
77
  }
78
78
 
79
- const logger = new Smartlog({ logContext: { /* your context */ } });
79
+ const logger = new Smartlog({
80
+ logContext: {
81
+ /* your context */
82
+ },
83
+ });
80
84
  logger.addLogDestination(new MyCustomLogDestination());
81
85
  ```
82
86
 
@@ -102,7 +106,7 @@ Remember to refer to the official documentation and the type definitions for det
102
106
 
103
107
  ## License and Legal Information
104
108
 
105
- This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
109
+ This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
106
110
 
107
111
  **Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
108
112
 
package/readme.plan.md ADDED
File without changes
@@ -1,8 +1,8 @@
1
1
  /**
2
- * autocreated commitinfo by @pushrocks/commitinfo
2
+ * autocreated commitinfo by @push.rocks/commitinfo
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartlog',
6
- version: '3.0.6',
6
+ version: '3.0.8',
7
7
  description: 'A minimalistic, distributed, and extensible logging tool supporting centralized log management.'
8
8
  }
@@ -8,7 +8,7 @@ export class ConsoleLog {
8
8
  logLevelArg: plugins.smartlogInterfaces.TLogLevel,
9
9
  logMessageArg: string,
10
10
  dataArg?: any,
11
- correlationArg?: plugins.smartlogInterfaces.ILogCorrelation
11
+ correlationArg?: plugins.smartlogInterfaces.ILogCorrelation,
12
12
  ) {
13
13
  console.log(`__# ${logLevelArg}: ${logMessageArg}`);
14
14
  }
@@ -14,7 +14,7 @@ export class LogGroup {
14
14
  public log(
15
15
  logLevelArg: plugins.smartlogInterfaces.TLogLevel,
16
16
  logMessageArg: string,
17
- logDataArg?: any
17
+ logDataArg?: any,
18
18
  ) {
19
19
  this.smartlogRef.log(logLevelArg, logMessageArg, logDataArg, {
20
20
  id: plugins.isounique.uni(),
@@ -9,6 +9,18 @@ export interface ISmartlogContructorOptions {
9
9
  }
10
10
 
11
11
  export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
12
+ // STATIC
13
+ public static createForCommitinfo(
14
+ commitinfo: plugins.smartlogInterfaces.ILogContext['commitinfo'],
15
+ ) {
16
+ return new Smartlog({
17
+ logContext: {
18
+ commitinfo,
19
+ },
20
+ });
21
+ }
22
+
23
+ // INSTANCE
12
24
  public logContext: plugins.smartlogInterfaces.ILogContext;
13
25
  public minimumLogLevel: plugins.smartlogInterfaces.TLogLevel;
14
26
 
@@ -85,7 +97,7 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
85
97
  logLevelArg: plugins.smartlogInterfaces.TLogLevel,
86
98
  logMessageArg: string,
87
99
  logDataArg?: any,
88
- correlationArg?: plugins.smartlogInterfaces.ILogCorrelation
100
+ correlationArg?: plugins.smartlogInterfaces.ILogCorrelation,
89
101
  ) {
90
102
  correlationArg = {
91
103
  ...{
@@ -121,7 +133,7 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
121
133
  correlationArg: plugins.smartlogInterfaces.ILogCorrelation = {
122
134
  id: plugins.isounique.uni(),
123
135
  type: 'none',
124
- }
136
+ },
125
137
  ) {
126
138
  if (this.consoleEnabled) {
127
139
  this.safeConsoleLog(`INCREMENT: ${logLevelArg}: ${logMessageArg}`);
@@ -142,7 +154,7 @@ export class Smartlog implements plugins.smartlogInterfaces.ILogDestination {
142
154
 
143
155
  private safeConsoleLog(logLine: string) {
144
156
  console.log(
145
- `LOG => ${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()} => ${logLine}`
157
+ `LOG => ${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()} => ${logLine}`,
146
158
  );
147
159
  }
148
160
 
@@ -1,4 +1,4 @@
1
1
  import * as isounique from '@push.rocks/isounique';
2
- import * as smartlogInterfaces from '@push.rocks/smartlog-interfaces';
2
+ import * as smartlogInterfaces from '../dist_ts_interfaces/index.js';
3
3
 
4
4
  export { isounique, smartlogInterfaces };