@prairielearn/logger 1.0.0 → 1.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/CHANGELOG.md +13 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +4 -7
- package/dist/index.js.map +1 -1
- package/package.json +11 -6
- package/src/index.ts +5 -5
- package/tsconfig.json +1 -1
package/CHANGELOG.md
ADDED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.addFileLogging = exports.logger = void 0;
|
|
7
|
-
const winston_1 =
|
|
4
|
+
const winston_1 = require("winston");
|
|
8
5
|
const logform_1 = require("logform");
|
|
9
|
-
exports.logger = winston_1.
|
|
6
|
+
exports.logger = (0, winston_1.createLogger)({
|
|
10
7
|
transports: [
|
|
11
|
-
new winston_1.
|
|
8
|
+
new winston_1.transports.Console({
|
|
12
9
|
level: 'info',
|
|
13
10
|
format: logform_1.format.combine(logform_1.format.colorize(), logform_1.format.simple()),
|
|
14
11
|
}),
|
|
15
12
|
],
|
|
16
13
|
});
|
|
17
14
|
function addFileLogging(options) {
|
|
18
|
-
exports.logger.add(new winston_1.
|
|
15
|
+
exports.logger.add(new winston_1.transports.File({
|
|
19
16
|
filename: options.filename,
|
|
20
17
|
level: options.level ?? 'debug',
|
|
21
18
|
format: logform_1.format.combine(logform_1.format.timestamp(), logform_1.format.json()),
|
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,qCAAmD;AACnD,qCAAiC;AAEpB,QAAA,MAAM,GAAG,IAAA,sBAAY,EAAC;IACjC,UAAU,EAAE;QACV,IAAI,oBAAU,CAAC,OAAO,CAAC;YACrB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,gBAAM,CAAC,OAAO,CAAC,gBAAM,CAAC,QAAQ,EAAE,EAAE,gBAAM,CAAC,MAAM,EAAE,CAAC;SAC3D,CAAC;KACH;CACF,CAAC,CAAC;AAOH,SAAgB,cAAc,CAAC,OAA8B;IAC3D,cAAM,CAAC,GAAG,CACR,IAAI,oBAAU,CAAC,IAAI,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO;QAC/B,MAAM,EAAE,gBAAM,CAAC,OAAO,CAAC,gBAAM,CAAC,SAAS,EAAE,EAAE,gBAAM,CAAC,IAAI,EAAE,CAAC;KAC1D,CAAC,CACH,CAAC;AACJ,CAAC;AARD,wCAQC"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prairielearn/logger",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/PrairieLearn/PrairieLearn.git",
|
|
8
|
+
"directory": "packages/logger"
|
|
9
|
+
},
|
|
5
10
|
"scripts": {
|
|
6
11
|
"build": "tsc",
|
|
7
12
|
"dev": "tsc --watch --preserveWatchOutput"
|
|
8
13
|
},
|
|
9
14
|
"devDependencies": {
|
|
10
|
-
"@prairielearn/tsconfig": "
|
|
11
|
-
"@types/node": "^18.
|
|
12
|
-
"typescript": "^
|
|
15
|
+
"@prairielearn/tsconfig": "^0.0.0",
|
|
16
|
+
"@types/node": "^18.16.19",
|
|
17
|
+
"typescript": "^5.1.6"
|
|
13
18
|
},
|
|
14
19
|
"dependencies": {
|
|
15
20
|
"logform": "^2.5.1",
|
|
16
|
-
"winston": "^3.
|
|
17
|
-
"zod": "^3.
|
|
21
|
+
"winston": "^3.9.0",
|
|
22
|
+
"zod": "^3.21.4"
|
|
18
23
|
}
|
|
19
24
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createLogger, transports } from 'winston';
|
|
2
2
|
import { format } from 'logform';
|
|
3
3
|
|
|
4
|
-
export const logger =
|
|
4
|
+
export const logger = createLogger({
|
|
5
5
|
transports: [
|
|
6
|
-
new
|
|
6
|
+
new transports.Console({
|
|
7
7
|
level: 'info',
|
|
8
8
|
format: format.combine(format.colorize(), format.simple()),
|
|
9
9
|
}),
|
|
@@ -17,10 +17,10 @@ interface AddFileLoggingOptions {
|
|
|
17
17
|
|
|
18
18
|
export function addFileLogging(options: AddFileLoggingOptions) {
|
|
19
19
|
logger.add(
|
|
20
|
-
new
|
|
20
|
+
new transports.File({
|
|
21
21
|
filename: options.filename,
|
|
22
22
|
level: options.level ?? 'debug',
|
|
23
23
|
format: format.combine(format.timestamp(), format.json()),
|
|
24
|
-
})
|
|
24
|
+
}),
|
|
25
25
|
);
|
|
26
26
|
}
|
package/tsconfig.json
CHANGED