@vrplatform/log 3.0.1 → 3.0.2
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/build/main/log/baselog.js +1 -1
- package/build/main/log/baselog.js.map +1 -1
- package/build/main/log/index.d.ts +1 -1
- package/build/main/log/index.js +1 -1
- package/build/main/log/index.js.map +1 -1
- package/build/main/tracking/index.d.ts +8 -8
- package/build/main/tracking/index.js +10 -10
- package/build/main/tracking/index.js.map +1 -1
- package/build/main/tracking/mixpanel.js +1 -1
- package/build/main/tracking/mixpanel.js.map +1 -1
- package/build/module/log/baselog.js +1 -1
- package/build/module/log/baselog.js.map +1 -1
- package/build/module/log/index.d.ts +1 -1
- package/build/module/log/index.js +1 -1
- package/build/module/log/index.js.map +1 -1
- package/build/module/tracking/index.d.ts +8 -8
- package/build/module/tracking/index.js +18 -18
- package/build/module/tracking/index.js.map +1 -1
- package/build/module/tracking/mixpanel.js +1 -1
- package/build/module/tracking/mixpanel.js.map +1 -1
- package/package.json +4 -4
- package/src/log/baselog.ts +1 -1
- package/src/log/index.ts +1 -1
- package/src/tracking/index.ts +27 -27
- package/src/tracking/mixpanel.ts +1 -1
- package/build/main/baselog.d.ts +0 -19
- package/build/main/baselog.js +0 -137
- package/build/main/baselog.js.map +0 -1
- package/build/main/color.d.ts +0 -54
- package/build/main/color.js +0 -371
- package/build/main/color.js.map +0 -1
- package/build/main/common.d.ts +0 -29
- package/build/main/common.js +0 -86
- package/build/main/common.js.map +0 -1
- package/build/main/index.spec.d.ts +0 -0
- package/build/main/index.spec.js +0 -2
- package/build/main/index.spec.js.map +0 -1
- package/build/main/type.d.ts +0 -39
- package/build/main/type.js +0 -3
- package/build/main/type.js.map +0 -1
- package/build/module/baselog.d.ts +0 -19
- package/build/module/baselog.js +0 -120
- package/build/module/baselog.js.map +0 -1
- package/build/module/color.d.ts +0 -54
- package/build/module/color.js +0 -375
- package/build/module/color.js.map +0 -1
- package/build/module/common.d.ts +0 -29
- package/build/module/common.js +0 -80
- package/build/module/common.js.map +0 -1
- package/build/module/index.spec.d.ts +0 -0
- package/build/module/index.spec.js +0 -2
- package/build/module/index.spec.js.map +0 -1
- package/build/module/type.d.ts +0 -39
- package/build/module/type.js +0 -2
- package/build/module/type.js.map +0 -1
package/src/tracking/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module
|
|
1
|
+
declare module "intercom-client" {
|
|
2
2
|
export namespace Intercom {
|
|
3
3
|
export interface CreateContactRequestWithExternalId {
|
|
4
4
|
/** A unique identifier for the contact which is given to Intercom */
|
|
@@ -22,7 +22,7 @@ declare module 'intercom-client' {
|
|
|
22
22
|
}
|
|
23
23
|
interface UpdateContactRequest {
|
|
24
24
|
/** The role of the contact. */
|
|
25
|
-
role?:
|
|
25
|
+
role?: "user" | "lead";
|
|
26
26
|
/** A unique identifier for the contact which is given to Intercom */
|
|
27
27
|
external_id?: string;
|
|
28
28
|
/** The contacts email */
|
|
@@ -98,22 +98,22 @@ declare module 'intercom-client' {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
import { useHasuraClient } from
|
|
102
|
-
import { Intercom } from
|
|
103
|
-
import { type LogBindings, useLog, type WorkerLog } from
|
|
104
|
-
import { isTest, isVrpMember } from
|
|
105
|
-
import { convertValuesToString } from
|
|
106
|
-
import { MixpanelClient } from
|
|
101
|
+
import { useHasuraClient } from "@vrplatform/graphql";
|
|
102
|
+
import { Intercom } from "intercom-client";
|
|
103
|
+
import { type LogBindings, useLog, type WorkerLog } from "../log";
|
|
104
|
+
import { isTest, isVrpMember } from "../utils";
|
|
105
|
+
import { convertValuesToString } from "../utils/convertValuesToString";
|
|
106
|
+
import { MixpanelClient } from "./mixpanel";
|
|
107
107
|
import type {
|
|
108
108
|
GroupProps,
|
|
109
109
|
IdentifyProps,
|
|
110
110
|
TrackingEvent,
|
|
111
111
|
TrackProps,
|
|
112
|
-
} from
|
|
112
|
+
} from "./types";
|
|
113
113
|
|
|
114
|
-
export * from
|
|
115
|
-
export * from
|
|
116
|
-
export * from
|
|
114
|
+
export * from "intercom-client";
|
|
115
|
+
export * from "../utils";
|
|
116
|
+
export * from "./types";
|
|
117
117
|
|
|
118
118
|
export type Tracking = ReturnType<typeof useTracking>;
|
|
119
119
|
export type UseTracking = {
|
|
@@ -133,11 +133,11 @@ export type UseTracking = {
|
|
|
133
133
|
|
|
134
134
|
export const useTracking = (
|
|
135
135
|
{ dataset, env, name }: UseTracking,
|
|
136
|
-
isDev?: boolean
|
|
136
|
+
isDev?: boolean,
|
|
137
137
|
): {
|
|
138
138
|
track: <T extends TrackingEvent>(
|
|
139
139
|
props: TrackProps<T>,
|
|
140
|
-
_import?: boolean
|
|
140
|
+
_import?: boolean,
|
|
141
141
|
) => Promise<void>;
|
|
142
142
|
identify: (props: IdentifyProps) => Promise<void>;
|
|
143
143
|
group: (props: GroupProps) => Promise<void>;
|
|
@@ -176,11 +176,11 @@ export const useTracking = (
|
|
|
176
176
|
properties,
|
|
177
177
|
timestamp,
|
|
178
178
|
}: TrackProps<T>,
|
|
179
|
-
_import = false
|
|
179
|
+
_import = false,
|
|
180
180
|
) => {
|
|
181
181
|
if (
|
|
182
182
|
isDev ||
|
|
183
|
-
isTest(userId || anonymousId ||
|
|
183
|
+
isTest(userId || anonymousId || "", groupId) ||
|
|
184
184
|
isVrpMember(userId || anonymousId)
|
|
185
185
|
)
|
|
186
186
|
return;
|
|
@@ -197,7 +197,7 @@ export const useTracking = (
|
|
|
197
197
|
// trackedAt: timestamp ? timestamp.toISOString() : undefined,
|
|
198
198
|
packageName,
|
|
199
199
|
},
|
|
200
|
-
}).id
|
|
200
|
+
}).id,
|
|
201
201
|
);
|
|
202
202
|
|
|
203
203
|
// track mixpanel event
|
|
@@ -214,7 +214,7 @@ export const useTracking = (
|
|
|
214
214
|
userId: userId,
|
|
215
215
|
...properties,
|
|
216
216
|
},
|
|
217
|
-
_import
|
|
217
|
+
_import,
|
|
218
218
|
);
|
|
219
219
|
|
|
220
220
|
if (userId) {
|
|
@@ -300,8 +300,8 @@ export const useTracking = (
|
|
|
300
300
|
const intercomUser = (
|
|
301
301
|
await intercom?.contacts.search({
|
|
302
302
|
query: {
|
|
303
|
-
field:
|
|
304
|
-
operator:
|
|
303
|
+
field: "external_id",
|
|
304
|
+
operator: "=",
|
|
305
305
|
value: userId,
|
|
306
306
|
},
|
|
307
307
|
})
|
|
@@ -321,7 +321,7 @@ export const useTracking = (
|
|
|
321
321
|
}: GroupProps) => {
|
|
322
322
|
if (
|
|
323
323
|
isDev ||
|
|
324
|
-
isTest(userId || anonymousId ||
|
|
324
|
+
isTest(userId || anonymousId || "", groupId) ||
|
|
325
325
|
isVrpMember(userId || anonymousId)
|
|
326
326
|
)
|
|
327
327
|
return;
|
|
@@ -334,11 +334,11 @@ export const useTracking = (
|
|
|
334
334
|
const billingPartner =
|
|
335
335
|
traits?.billingPartner || traits?.partner || traits?.accountingPartner; // TODO: remove legacy accountingPartner
|
|
336
336
|
|
|
337
|
-
if (billingPartner ===
|
|
337
|
+
if (billingPartner === "0b6a7bd6-56cc-46b5-b2ab-1bd7d1e994fa") return; // dismiss Demo and Test Console
|
|
338
338
|
|
|
339
339
|
// upsert mixpanel group
|
|
340
340
|
if (mixpanel)
|
|
341
|
-
mixpanel.group.set(
|
|
341
|
+
mixpanel.group.set("tenant", groupId, {
|
|
342
342
|
$distinct_id: groupId,
|
|
343
343
|
$name: traits?.name,
|
|
344
344
|
$avatar: traits.avatar,
|
|
@@ -365,7 +365,7 @@ export const useTracking = (
|
|
|
365
365
|
trialUntil: traits?.trialUntil,
|
|
366
366
|
isOnboarding: traits?.isOnboarding,
|
|
367
367
|
isTest: billingPartner
|
|
368
|
-
? billingPartner ===
|
|
368
|
+
? billingPartner === "Demo and Test Console"
|
|
369
369
|
: undefined,
|
|
370
370
|
});
|
|
371
371
|
|
|
@@ -401,7 +401,7 @@ export const useTracking = (
|
|
|
401
401
|
monthly_spend: traits?.mrr,
|
|
402
402
|
custom_attributes,
|
|
403
403
|
},
|
|
404
|
-
{}
|
|
404
|
+
{},
|
|
405
405
|
);
|
|
406
406
|
} catch (e) {
|
|
407
407
|
console.error(e);
|
|
@@ -413,8 +413,8 @@ export const useTracking = (
|
|
|
413
413
|
const intercomUser = (
|
|
414
414
|
await intercom?.contacts.search({
|
|
415
415
|
query: {
|
|
416
|
-
field:
|
|
417
|
-
operator:
|
|
416
|
+
field: "external_id",
|
|
417
|
+
operator: "=",
|
|
418
418
|
value: userId,
|
|
419
419
|
},
|
|
420
420
|
})
|
package/src/tracking/mixpanel.ts
CHANGED
package/build/main/baselog.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BaseLog } from './type';
|
|
2
|
-
export * from './type';
|
|
3
|
-
export declare function createBaseLog({ token, orgId, dataset, consoleLog, }: {
|
|
4
|
-
token?: string;
|
|
5
|
-
orgId?: string;
|
|
6
|
-
dataset?: string;
|
|
7
|
-
consoleLog?: boolean | 'color';
|
|
8
|
-
}, { environment, workerId, app, version, context, type, correlationId, executionContext, }: {
|
|
9
|
-
correlationId?: string;
|
|
10
|
-
environment?: 'development' | 'production';
|
|
11
|
-
type?: 'worker' | 'durableObject';
|
|
12
|
-
workerId?: string;
|
|
13
|
-
app?: string;
|
|
14
|
-
version?: string;
|
|
15
|
-
context?: Record<string, any>;
|
|
16
|
-
executionContext?: {
|
|
17
|
-
waitUntil(promise: Promise<any>): void;
|
|
18
|
-
};
|
|
19
|
-
}): BaseLog;
|
package/build/main/baselog.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createBaseLog = createBaseLog;
|
|
18
|
-
const common_1 = require("./common");
|
|
19
|
-
__exportStar(require("./type"), exports);
|
|
20
|
-
const js_1 = require("@axiomhq/js");
|
|
21
|
-
const serialize_error_1 = require("serialize-error");
|
|
22
|
-
const color_1 = require("./color");
|
|
23
|
-
let lastMessageTimestamp = undefined;
|
|
24
|
-
function createBaseLog({ token, orgId = 'vrplatform-mv6k', dataset, consoleLog, }, { environment, workerId, app, version, context, type, correlationId, executionContext, }) {
|
|
25
|
-
const baseFields = {
|
|
26
|
-
type: type || 'worker',
|
|
27
|
-
environment: environment || 'production',
|
|
28
|
-
worker: {
|
|
29
|
-
id: workerId || 'default',
|
|
30
|
-
app: app || 'default',
|
|
31
|
-
version: version || 'default',
|
|
32
|
-
started: new Date().toISOString(),
|
|
33
|
-
},
|
|
34
|
-
...context,
|
|
35
|
-
};
|
|
36
|
-
const axiom = token
|
|
37
|
-
? new js_1.Axiom({
|
|
38
|
-
token,
|
|
39
|
-
orgId,
|
|
40
|
-
onError(err) {
|
|
41
|
-
console.log('Axiom error', err);
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
: undefined;
|
|
45
|
-
function ingest(level, message, additionalFields = {}) {
|
|
46
|
-
axiom?.ingest(dataset, {
|
|
47
|
-
_time: Date.now(),
|
|
48
|
-
level,
|
|
49
|
-
message,
|
|
50
|
-
...baseFields,
|
|
51
|
-
...additionalFields,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function createBaseLog(arg = {}) {
|
|
55
|
-
const childContext = arg.context || {};
|
|
56
|
-
if (arg.request) {
|
|
57
|
-
childContext.request = (0, common_1.requestToContext)(arg.request);
|
|
58
|
-
}
|
|
59
|
-
const baseLog = (level, message, additionalContext = {}, error) => {
|
|
60
|
-
const cid = arg.correlationId ||
|
|
61
|
-
correlationId ||
|
|
62
|
-
childContext?.correlationId ||
|
|
63
|
-
additionalContext?.correlationId ||
|
|
64
|
-
correlationId;
|
|
65
|
-
ingest(level, message, {
|
|
66
|
-
...childContext,
|
|
67
|
-
...additionalContext,
|
|
68
|
-
correlationId: cid,
|
|
69
|
-
});
|
|
70
|
-
if (consoleLog) {
|
|
71
|
-
const name = arg.name ? `${app}/${arg.name}` : app;
|
|
72
|
-
const lev = level.toUpperCase();
|
|
73
|
-
const now = Date.now();
|
|
74
|
-
const diff = (lastMessageTimestamp ? `${now - lastMessageTimestamp}ms ` : '').padEnd(6, ' ');
|
|
75
|
-
lastMessageTimestamp = now;
|
|
76
|
-
error = message instanceof Error ? message : error;
|
|
77
|
-
message = message instanceof Error ? message.message : message;
|
|
78
|
-
if (consoleLog === 'color')
|
|
79
|
-
color_1.logger
|
|
80
|
-
.dim()
|
|
81
|
-
.append(`${diff}`)
|
|
82
|
-
.reset()
|
|
83
|
-
.color('green')
|
|
84
|
-
.append(`[${name}] `)
|
|
85
|
-
.reset()
|
|
86
|
-
.bold()
|
|
87
|
-
.append(`${lev} `)
|
|
88
|
-
.reset()
|
|
89
|
-
.color('blue')
|
|
90
|
-
.bold()
|
|
91
|
-
.append(cid ? `[${cid}] ` : '')
|
|
92
|
-
.reset()
|
|
93
|
-
.append(message)
|
|
94
|
-
.log();
|
|
95
|
-
else
|
|
96
|
-
console.log(`[${lev}] [${name}]${cid ? ` [${cid}]` : ''} ${message}`, additionalContext);
|
|
97
|
-
if (error)
|
|
98
|
-
console.error(error);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
return {
|
|
102
|
-
addContext(arg) {
|
|
103
|
-
for (const key in arg) {
|
|
104
|
-
childContext[key] = arg[key];
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
child: ({ correlationId, name, request, context = {}, }) => createBaseLog({
|
|
108
|
-
correlationId: correlationId ||
|
|
109
|
-
(request ? (0, common_1.getCorrelationId)(request) : undefined) ||
|
|
110
|
-
undefined,
|
|
111
|
-
name,
|
|
112
|
-
request,
|
|
113
|
-
context: { ...childContext, ...context },
|
|
114
|
-
}),
|
|
115
|
-
error: (message, error) => {
|
|
116
|
-
const m = typeof message === 'string'
|
|
117
|
-
? message
|
|
118
|
-
: error?.message || error?.name || 'Error';
|
|
119
|
-
const e = typeof message === 'string' ? error : message;
|
|
120
|
-
return baseLog('error', m, e instanceof Error ? (0, serialize_error_1.serializeError)(e) : e, e);
|
|
121
|
-
},
|
|
122
|
-
debug: (message, data) => baseLog('debug', message, data),
|
|
123
|
-
warn: (message, data) => baseLog('warn', message, data),
|
|
124
|
-
info: (message, data) => baseLog('info', message, data),
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
const baseLog = createBaseLog();
|
|
128
|
-
baseLog.flush = () => {
|
|
129
|
-
if (executionContext && axiom) {
|
|
130
|
-
executionContext.waitUntil(axiom.flush());
|
|
131
|
-
}
|
|
132
|
-
else if (axiom)
|
|
133
|
-
return axiom.flush();
|
|
134
|
-
};
|
|
135
|
-
return baseLog;
|
|
136
|
-
}
|
|
137
|
-
//# sourceMappingURL=baselog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"baselog.js","sourceRoot":"src/","sources":["baselog.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AASA,sCAgLC;AAzLD,qCAA8D;AAE9D,yCAAuB;AACvB,oCAAoC;AACpC,qDAAiD;AACjD,mCAAiC;AAEjC,IAAI,oBAAoB,GAAuB,SAAS,CAAC;AAEzD,SAAgB,aAAa,CAC3B,EAC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C,MAAM,CAAC,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;gBACxD,OAAO,OAAO,CACZ,OAAO,EACP,CAAC,EACD,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,IAAA,gCAAc,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1C,CAAC,CACF,CAAC;YACJ,CAAC;YACD,KAAK,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;YACzD,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;YACvD,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;SACxD,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,aAAa,EAAoB,CAAC;IAClD,OAAO,CAAC,KAAK,GAAG,GAAG,EAAE;QACnB,IAAI,gBAAgB,IAAI,KAAK,EAAE,CAAC;YAC9B,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/build/main/color.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export declare const objectEntries: <T extends object>(value: T) => { [K in keyof T]-?: [K, T[K]]; }[keyof T][];
|
|
2
|
-
export type LEVEL = 'debug' | 'info' | 'warn' | 'error' | 'disable' | 'success';
|
|
3
|
-
type ticketObject = {
|
|
4
|
-
font?: COLOR;
|
|
5
|
-
bg?: COLOR;
|
|
6
|
-
};
|
|
7
|
-
type settingObject = {
|
|
8
|
-
[key in SETTING]?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type SETTING = 'bold' | 'italic' | 'dim' | 'underscore' | 'reverse' | 'strikethrough';
|
|
11
|
-
export type COLOR = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white';
|
|
12
|
-
declare class Logger {
|
|
13
|
-
private command;
|
|
14
|
-
private lastCommand;
|
|
15
|
-
private name;
|
|
16
|
-
private level?;
|
|
17
|
-
private noColor;
|
|
18
|
-
private _getDate;
|
|
19
|
-
private _customizedConsole;
|
|
20
|
-
constructor(name?: string);
|
|
21
|
-
createNamedLogger(name: string): Logger;
|
|
22
|
-
setLevel(level: LEVEL): void;
|
|
23
|
-
setLogStream(newStream: any): void;
|
|
24
|
-
setLevelNoColor(): void;
|
|
25
|
-
setLevelColor(): void;
|
|
26
|
-
isLevelValid(level?: string): boolean;
|
|
27
|
-
isAllowedLevel(level: LEVEL): boolean;
|
|
28
|
-
log(...args: any[]): this;
|
|
29
|
-
joint(): this;
|
|
30
|
-
setDate(callback: () => string): void;
|
|
31
|
-
getPrefix(): string;
|
|
32
|
-
color(ticket: COLOR): this;
|
|
33
|
-
bgColor(ticket: COLOR): this;
|
|
34
|
-
bold(): this;
|
|
35
|
-
dim(): this;
|
|
36
|
-
underscore(): this;
|
|
37
|
-
strikethrough(): this;
|
|
38
|
-
reverse(): this;
|
|
39
|
-
italic(): this;
|
|
40
|
-
fontColorLog(ticket: COLOR, text: string, setting?: settingObject): void;
|
|
41
|
-
bgColorLog(ticket: COLOR, text: string, setting?: settingObject): void;
|
|
42
|
-
colorLog(ticketObj: ticketObject, text: string, setting?: settingObject): void;
|
|
43
|
-
error(...args: any[]): void;
|
|
44
|
-
warn(...args: any[]): void;
|
|
45
|
-
info(...args: any[]): void;
|
|
46
|
-
debug(...args: any[]): void;
|
|
47
|
-
success(...args: any[]): void;
|
|
48
|
-
checkSetting(setting: settingObject): string;
|
|
49
|
-
_print(...args: any[]): void;
|
|
50
|
-
append(...args: any[]): this;
|
|
51
|
-
reset(): this;
|
|
52
|
-
}
|
|
53
|
-
export declare const logger: Logger;
|
|
54
|
-
export {};
|