stentor-logger 1.61.13 → 1.61.16
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/README.md +32 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +19 -4
- package/lib/logger.js +192 -57
- package/lib/logger.js.map +1 -1
- package/package.json +17 -6
package/README.md
CHANGED
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
## stentor-logger
|
|
2
2
|
|
|
3
|
-
Simple logging library
|
|
3
|
+
Simple logging library with optional Winston support for 📣 stentor.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
By default, stentor-logger provides a console-based fallback logger. If you want enhanced logging features, you can optionally install and register Winston.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
## Basic Usage
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { log } from "stentor-logger";
|
|
9
11
|
|
|
10
12
|
log().debug("Hello");
|
|
11
13
|
log().debug({foo:true});
|
|
12
14
|
log().info("Payload %o", request);
|
|
13
15
|
log().warn("uh oh");
|
|
14
|
-
log.error(new Error("bar"));
|
|
16
|
+
log().error(new Error("bar"));
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Using with Winston (Optional)
|
|
20
|
+
|
|
21
|
+
To use Winston features, first install Winston:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install winston logform
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then stentor-logger will automatically detect and use Winston if available. You can also manually register a Winston logger:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { registerWinstonLogger } from "stentor-logger";
|
|
31
|
+
import { createLogger, format, transports } from "winston";
|
|
32
|
+
|
|
33
|
+
const customWinstonLogger = createLogger({
|
|
34
|
+
level: "info",
|
|
35
|
+
format: format.json(),
|
|
36
|
+
transports: [
|
|
37
|
+
new transports.File({ filename: "error.log", level: "error" }),
|
|
38
|
+
new transports.File({ filename: "combined.log" })
|
|
39
|
+
]
|
|
40
|
+
});
|
|
15
41
|
|
|
42
|
+
registerWinstonLogger(customWinstonLogger);
|
|
16
43
|
```
|
|
17
44
|
|
|
18
45
|
## Configuration
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.log = exports.classLogger = void 0;
|
|
3
|
+
exports.log = exports.registerWinstonLogger = exports.classLogger = void 0;
|
|
4
4
|
/*! Copyright (c) 2019, XAPPmedia */
|
|
5
5
|
const logger_1 = require("./logger");
|
|
6
6
|
var logger_2 = require("./logger");
|
|
7
7
|
Object.defineProperty(exports, "classLogger", { enumerable: true, get: function () { return logger_2.classLogger; } });
|
|
8
|
+
Object.defineProperty(exports, "registerWinstonLogger", { enumerable: true, get: function () { return logger_2.registerWinstonLogger; } });
|
|
8
9
|
var logger_3 = require("./logger");
|
|
9
10
|
Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logger_3.log; } });
|
|
10
11
|
exports.default = (0, logger_1.log)();
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,qCAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,qCAA+B;AAC/B,mCAA8D;AAArD,qGAAA,WAAW,OAAA;AAAE,+GAAA,qBAAqB,OAAA;AAE3C,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AACZ,kBAAe,IAAA,YAAG,GAAE,CAAC"}
|
package/lib/logger.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/*! Copyright (c) 2019, XAPPmedia */
|
|
2
|
-
|
|
2
|
+
interface WinstonTransformableInfo {
|
|
3
|
+
level: string;
|
|
4
|
+
message: any;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
3
7
|
export interface LoggerMethod {
|
|
4
8
|
(message: string, ...meta: any[]): Logger;
|
|
5
9
|
(infoObject: object): Logger;
|
|
@@ -11,11 +15,13 @@ export interface Logger {
|
|
|
11
15
|
error: LoggerMethod;
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
|
-
* Custom
|
|
18
|
+
* Custom transformer for redacting PII.
|
|
19
|
+
* Works with Winston's TransformableInfo or fallback info objects.
|
|
15
20
|
*/
|
|
16
|
-
export declare function redact(info:
|
|
21
|
+
export declare function redact(info: WinstonTransformableInfo): WinstonTransformableInfo;
|
|
17
22
|
/**
|
|
18
23
|
* Get an instance of the shared logger.
|
|
24
|
+
* Uses Winston if available, otherwise falls back to console logger.
|
|
19
25
|
*
|
|
20
26
|
* @returns {Logger}
|
|
21
27
|
*/
|
|
@@ -28,7 +34,15 @@ export declare function log(): Logger;
|
|
|
28
34
|
*
|
|
29
35
|
* @param {Logger} logger
|
|
30
36
|
*/
|
|
31
|
-
export declare function set(logger: Logger): void;
|
|
37
|
+
export declare function set(logger: Logger | undefined): void;
|
|
38
|
+
/**
|
|
39
|
+
* Register a Winston logger instance for use by stentor-logger.
|
|
40
|
+
* This allows implementors to provide their own Winston configuration
|
|
41
|
+
* without stentor-logger having Winston as a required dependency.
|
|
42
|
+
*
|
|
43
|
+
* @param {any} winstonLogger - A Winston logger instance
|
|
44
|
+
*/
|
|
45
|
+
export declare function registerWinstonLogger(winstonLogger: any): void;
|
|
32
46
|
/**
|
|
33
47
|
* Create a class logger that will add the className to the log message.
|
|
34
48
|
*
|
|
@@ -36,3 +50,4 @@ export declare function set(logger: Logger): void;
|
|
|
36
50
|
* @returns {Logger}
|
|
37
51
|
*/
|
|
38
52
|
export declare function classLogger(className: string): Logger;
|
|
53
|
+
export {};
|
package/lib/logger.js
CHANGED
|
@@ -4,14 +4,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.redact = redact;
|
|
5
5
|
exports.log = log;
|
|
6
6
|
exports.set = set;
|
|
7
|
+
exports.registerWinstonLogger = registerWinstonLogger;
|
|
7
8
|
exports.classLogger = classLogger;
|
|
8
9
|
const stentor_utils_1 = require("stentor-utils");
|
|
9
10
|
const chalk = require("chalk");
|
|
10
|
-
|
|
11
|
+
// Try to import Winston dynamically - it might not be available
|
|
12
|
+
let winston = null;
|
|
13
|
+
try {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
15
|
+
winston = require("winston");
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
// Winston is not available, will use fallback logger
|
|
19
|
+
winston = null;
|
|
20
|
+
}
|
|
11
21
|
// Shared Global instance.
|
|
12
22
|
let LOGGER;
|
|
13
23
|
/**
|
|
14
|
-
* Custom
|
|
24
|
+
* Custom transformer for redacting PII.
|
|
25
|
+
* Works with Winston's TransformableInfo or fallback info objects.
|
|
15
26
|
*/
|
|
16
27
|
function redact(info) {
|
|
17
28
|
// fast pass through check
|
|
@@ -68,72 +79,178 @@ function isOnAWSLambda() {
|
|
|
68
79
|
return !!process.env.AWS_LAMBDA_FUNCTION_NAME;
|
|
69
80
|
}
|
|
70
81
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @returns {Logger}
|
|
82
|
+
* Creates a fallback console logger when Winston is not available.
|
|
74
83
|
*/
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
function createFallbackLogger(level) {
|
|
85
|
+
const shouldLog = (logLevel) => {
|
|
86
|
+
const levels = {
|
|
87
|
+
error: 0,
|
|
88
|
+
warn: 1,
|
|
89
|
+
info: 2,
|
|
90
|
+
debug: 3,
|
|
91
|
+
};
|
|
92
|
+
return levels[logLevel] <= levels[level];
|
|
93
|
+
};
|
|
94
|
+
const fallbackLogger = {
|
|
95
|
+
debug: () => fallbackLogger,
|
|
96
|
+
info: () => fallbackLogger,
|
|
97
|
+
warn: () => fallbackLogger,
|
|
98
|
+
error: () => fallbackLogger,
|
|
99
|
+
};
|
|
100
|
+
const logMethod = (logLevel) => {
|
|
101
|
+
return (message) => {
|
|
102
|
+
if (!shouldLog(logLevel)) {
|
|
103
|
+
return fallbackLogger;
|
|
104
|
+
}
|
|
105
|
+
// Apply PII redaction
|
|
106
|
+
let processedMessage = message;
|
|
107
|
+
if (typeof message === "string" || typeof message === "object") {
|
|
108
|
+
const info = redact({ level: logLevel, message });
|
|
109
|
+
processedMessage = info.message;
|
|
110
|
+
}
|
|
111
|
+
let lead;
|
|
112
|
+
switch (logLevel) {
|
|
113
|
+
case "debug":
|
|
114
|
+
lead = chalk.blue("debug");
|
|
115
|
+
break;
|
|
116
|
+
case "info":
|
|
117
|
+
lead = chalk.green(" info");
|
|
118
|
+
break;
|
|
119
|
+
case "warn":
|
|
120
|
+
lead = chalk.yellow(" warn");
|
|
121
|
+
break;
|
|
122
|
+
case "error":
|
|
123
|
+
lead = chalk.red("error");
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
lead = " 📣";
|
|
127
|
+
}
|
|
128
|
+
let output;
|
|
129
|
+
if (typeof processedMessage === "object") {
|
|
130
|
+
const jsonMessage = isOnAWSLambda()
|
|
131
|
+
? JSON.stringify(processedMessage)
|
|
132
|
+
: JSON.stringify(processedMessage, undefined, 2);
|
|
133
|
+
if (isOnAWSLambda()) {
|
|
134
|
+
output = `${lead}|${jsonMessage}`;
|
|
96
135
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
break;
|
|
106
|
-
case "warn":
|
|
107
|
-
// space here is to help with readability
|
|
108
|
-
lead = chalk.yellow(" warn");
|
|
109
|
-
break;
|
|
110
|
-
case "error":
|
|
111
|
-
lead = chalk.red("error");
|
|
112
|
-
break;
|
|
113
|
-
default:
|
|
114
|
-
lead = " 📣";
|
|
136
|
+
else {
|
|
137
|
+
const time = new Date().toLocaleTimeString([], {
|
|
138
|
+
minute: "2-digit",
|
|
139
|
+
hour: "2-digit",
|
|
140
|
+
second: "2-digit",
|
|
141
|
+
hour12: false,
|
|
142
|
+
});
|
|
143
|
+
output = `${lead}|${time}|${jsonMessage}`;
|
|
115
144
|
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
116
147
|
if (isOnAWSLambda()) {
|
|
117
|
-
|
|
118
|
-
return `${lead}|${info.message}`;
|
|
148
|
+
output = `${lead}|${processedMessage}`;
|
|
119
149
|
}
|
|
120
|
-
else
|
|
121
|
-
|
|
122
|
-
const time = new Date(info.timestamp).toLocaleTimeString([], {
|
|
150
|
+
else {
|
|
151
|
+
const time = new Date().toLocaleTimeString([], {
|
|
123
152
|
minute: "2-digit",
|
|
124
153
|
hour: "2-digit",
|
|
125
154
|
second: "2-digit",
|
|
126
155
|
hour12: false,
|
|
127
156
|
});
|
|
128
|
-
|
|
157
|
+
output = `${lead}|${time}|${processedMessage}`;
|
|
129
158
|
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
159
|
+
}
|
|
160
|
+
// eslint-disable-next-line no-console
|
|
161
|
+
console.log(output);
|
|
162
|
+
return fallbackLogger;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
fallbackLogger.debug = logMethod("debug");
|
|
166
|
+
fallbackLogger.info = logMethod("info");
|
|
167
|
+
fallbackLogger.warn = logMethod("warn");
|
|
168
|
+
fallbackLogger.error = logMethod("error");
|
|
169
|
+
return fallbackLogger;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Creates a Winston logger if available, otherwise falls back to console logger.
|
|
173
|
+
*/
|
|
174
|
+
function createWinstonLogger(level) {
|
|
175
|
+
if (!winston) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
const winstonLogger = winston.createLogger({
|
|
179
|
+
format: winston.format.combine(winston.format((info) => {
|
|
180
|
+
const allowedClass = process.env.STENTOR_LOG_CLASS;
|
|
181
|
+
const infoClass = info.className;
|
|
182
|
+
if (allowedClass && infoClass !== allowedClass) {
|
|
183
|
+
return false; // skip log
|
|
184
|
+
}
|
|
185
|
+
return info;
|
|
186
|
+
})(), winston.format(redact)(), winston.format.prettyPrint(), winston.format.splat(), winston.format.timestamp(), winston.format.printf((info) => {
|
|
187
|
+
if (info.message && info.message.constructor === Object) {
|
|
188
|
+
// for AWS, if you pretty print then it takes up new lines in CloudWatch, which pollutes
|
|
189
|
+
// your log messages so we check to see if we are in a lambda runtime
|
|
190
|
+
if (isOnAWSLambda()) {
|
|
191
|
+
info.message = JSON.stringify(info.message);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
info.message = JSON.stringify(info.message, undefined, 2);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
let lead;
|
|
198
|
+
switch (info.level) {
|
|
199
|
+
case "debug":
|
|
200
|
+
lead = chalk.blue("debug");
|
|
201
|
+
break;
|
|
202
|
+
case "info":
|
|
203
|
+
// space here is to help with readability
|
|
204
|
+
lead = chalk.green(" info");
|
|
205
|
+
break;
|
|
206
|
+
case "warn":
|
|
207
|
+
// space here is to help with readability
|
|
208
|
+
lead = chalk.yellow(" warn");
|
|
209
|
+
break;
|
|
210
|
+
case "error":
|
|
211
|
+
lead = chalk.red("error");
|
|
212
|
+
break;
|
|
213
|
+
default:
|
|
214
|
+
lead = " 📣";
|
|
215
|
+
}
|
|
216
|
+
if (isOnAWSLambda()) {
|
|
217
|
+
// CloudWatch automatically includes the timestamp, it isn't needed
|
|
218
|
+
return `${lead}|${info.message}`;
|
|
219
|
+
}
|
|
220
|
+
else if (typeof info.timestamp === "string") {
|
|
221
|
+
// outside, just print the time mm
|
|
222
|
+
const time = new Date(info.timestamp).toLocaleTimeString([], {
|
|
223
|
+
minute: "2-digit",
|
|
224
|
+
hour: "2-digit",
|
|
225
|
+
second: "2-digit",
|
|
226
|
+
hour12: false,
|
|
227
|
+
});
|
|
228
|
+
return `${lead}|${time}|${info.message}`;
|
|
229
|
+
}
|
|
230
|
+
})),
|
|
231
|
+
transports: [
|
|
232
|
+
new winston.transports.Console({
|
|
233
|
+
level,
|
|
234
|
+
}),
|
|
235
|
+
],
|
|
236
|
+
});
|
|
237
|
+
return winstonLogger;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get an instance of the shared logger.
|
|
241
|
+
* Uses Winston if available, otherwise falls back to console logger.
|
|
242
|
+
*
|
|
243
|
+
* @returns {Logger}
|
|
244
|
+
*/
|
|
245
|
+
function log() {
|
|
246
|
+
if (!LOGGER) {
|
|
247
|
+
const level = process.env.STENTOR_LOG_LEVEL || process.env.OVAI_LOG_LEVEL || "error";
|
|
248
|
+
// Try to create Winston logger first
|
|
249
|
+
LOGGER = createWinstonLogger(level);
|
|
250
|
+
// If Winston is not available, use fallback logger
|
|
251
|
+
if (!LOGGER) {
|
|
252
|
+
LOGGER = createFallbackLogger(level);
|
|
253
|
+
}
|
|
137
254
|
}
|
|
138
255
|
return LOGGER;
|
|
139
256
|
}
|
|
@@ -148,6 +265,24 @@ function log() {
|
|
|
148
265
|
function set(logger) {
|
|
149
266
|
LOGGER = logger;
|
|
150
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Register a Winston logger instance for use by stentor-logger.
|
|
270
|
+
* This allows implementors to provide their own Winston configuration
|
|
271
|
+
* without stentor-logger having Winston as a required dependency.
|
|
272
|
+
*
|
|
273
|
+
* @param {any} winstonLogger - A Winston logger instance
|
|
274
|
+
*/
|
|
275
|
+
function registerWinstonLogger(winstonLogger) {
|
|
276
|
+
// Ensure the passed object has the required methods
|
|
277
|
+
if (!winstonLogger ||
|
|
278
|
+
typeof winstonLogger.debug !== "function" ||
|
|
279
|
+
typeof winstonLogger.info !== "function" ||
|
|
280
|
+
typeof winstonLogger.warn !== "function" ||
|
|
281
|
+
typeof winstonLogger.error !== "function") {
|
|
282
|
+
throw new Error("Invalid Winston logger: must have debug, info, warn, and error methods");
|
|
283
|
+
}
|
|
284
|
+
LOGGER = winstonLogger;
|
|
285
|
+
}
|
|
151
286
|
/**
|
|
152
287
|
* Create a class logger that will add the className to the log message.
|
|
153
288
|
*
|
package/lib/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA,oCAAoC;;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA,oCAAoC;;AAoEpC,wBAqDC;AA8LD,kBAaC;AAUD,kBAEC;AASD,sDAaC;AAQD,kCAkBC;AA9XD,iDAA6D;AAC7D,+BAAgC;AAmChC,gEAAgE;AAChE,IAAI,OAAO,GAAyB,IAAI,CAAC;AAEzC,IAAI,CAAC;IACH,8DAA8D;IAC9D,OAAO,GAAG,OAAO,CAAC,SAAS,CAAkB,CAAC;AAChD,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,qDAAqD;IACrD,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC;AAcD,0BAA0B;AAC1B,IAAI,MAAc,CAAC;AAEnB;;;GAGG;AACH,SAAgB,MAAM,CAAC,IAA8B;IACnD,0BAA0B;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;QAC9F,OAAO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AAI,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;KACrB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.61.
|
|
8
|
-
"description": "Simple logging library
|
|
7
|
+
"version": "1.61.16",
|
|
8
|
+
"description": "Simple logging library with optional Winston support for 📣 stentor",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
11
11
|
"files": [
|
|
@@ -23,19 +23,30 @@
|
|
|
23
23
|
"mocha": "11.7.2",
|
|
24
24
|
"sinon": "20.0.0",
|
|
25
25
|
"sinon-chai": "3.7.0",
|
|
26
|
-
"stentor-models": "1.61.
|
|
26
|
+
"stentor-models": "1.61.16",
|
|
27
27
|
"ts-node": "10.9.2",
|
|
28
28
|
"typescript": "5.9.2"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"chalk": "4.1.2",
|
|
32
|
-
"stentor-utils": "1.61.
|
|
33
|
-
|
|
32
|
+
"stentor-utils": "1.61.16"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"logform": ">=1.0.0",
|
|
36
|
+
"winston": ">=3.0.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"logform": {
|
|
40
|
+
"optional": true
|
|
41
|
+
},
|
|
42
|
+
"winston": {
|
|
43
|
+
"optional": true
|
|
44
|
+
}
|
|
34
45
|
},
|
|
35
46
|
"scripts": {
|
|
36
47
|
"build": "tsc -d true -p .",
|
|
37
48
|
"clean": "rm -rf ./lib/*",
|
|
38
49
|
"test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\""
|
|
39
50
|
},
|
|
40
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "1e6a886b5f5e35b123ab981681a482cd679aa7b0"
|
|
41
52
|
}
|