@prairielearn/logger 1.0.14 → 2.0.0
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/CHANGELOG.md +12 -0
- package/dist/index.js +8 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const winston_1 = require("winston");
|
|
5
|
-
const logform_1 = require("logform");
|
|
6
|
-
exports.logger = (0, winston_1.createLogger)({
|
|
1
|
+
import { createLogger, transports } from 'winston';
|
|
2
|
+
import { format } from 'logform';
|
|
3
|
+
export const logger = createLogger({
|
|
7
4
|
transports: [
|
|
8
|
-
new
|
|
5
|
+
new transports.Console({
|
|
9
6
|
level: 'info',
|
|
10
|
-
format:
|
|
7
|
+
format: format.combine(format.colorize(), format.simple()),
|
|
11
8
|
}),
|
|
12
9
|
],
|
|
13
10
|
});
|
|
14
|
-
function addFileLogging(options) {
|
|
15
|
-
|
|
11
|
+
export function addFileLogging(options) {
|
|
12
|
+
logger.add(new transports.File({
|
|
16
13
|
filename: options.filename,
|
|
17
14
|
level: options.level ?? 'debug',
|
|
18
|
-
format:
|
|
15
|
+
format: format.combine(format.timestamp(), format.json()),
|
|
19
16
|
}));
|
|
20
17
|
}
|
|
21
|
-
exports.addFileLogging = addFileLogging;
|
|
22
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC;IACjC,UAAU,EAAE;QACV,IAAI,UAAU,CAAC,OAAO,CAAC;YACrB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;SAC3D,CAAC;KACH;CACF,CAAC,CAAC;AAOH,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,CAAC,GAAG,CACR,IAAI,UAAU,CAAC,IAAI,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO;QAC/B,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;KAC1D,CAAC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { createLogger, transports } from 'winston';\nimport { format } from 'logform';\n\nexport const logger = createLogger({\n transports: [\n new transports.Console({\n level: 'info',\n format: format.combine(format.colorize(), format.simple()),\n }),\n ],\n});\n\ninterface AddFileLoggingOptions {\n filename: string;\n level?: string;\n}\n\nexport function addFileLogging(options: AddFileLoggingOptions) {\n logger.add(\n new transports.File({\n filename: options.filename,\n level: options.level ?? 'debug',\n format: format.combine(format.timestamp(), format.json()),\n }),\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prairielearn/logger",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "./dist/index.js",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
16
|
"@prairielearn/tsconfig": "^0.0.0",
|
|
16
|
-
"@types/node": "^20.
|
|
17
|
+
"@types/node": "^20.12.2",
|
|
17
18
|
"typescript": "^5.4.3"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|