Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@types/sinon": "^9.0.10",
"@types/supertest": "^2.0.10",
"@types/supports-color": "^7.2.0",
"@types/terser-webpack-plugin": "^5.0.2",
"@types/terser-webpack-plugin": "^2.2.3",
"@types/tmp": "^0.2.0",
"@types/unzipper": "^0.10.3",
"@types/uuid": "^7.0.3",
Expand All @@ -95,7 +95,7 @@
"aws-sdk-mock": "^5.1.0",
"axios": "^0.27.2",
"conventional-changelog-conventionalcommits": "^4.6.3",
"coveralls": "^3.1.0",
"coveralls": "^3.1.1",
"crypto-browserify": "^3.12.0",
"eslint": "^7.0.0",
"graphql": "^14.0.2",
Expand All @@ -114,7 +114,7 @@
"typescript": "^3.9.9"
},
"dependencies": {
"@babel/core": "^7.12.3",
"@babel/core": "^7.22.11",
"@babel/plugin-proposal-async-generator-functions": "^7.12.1",
"@babel/plugin-transform-async-to-generator": "^7.12.1",
"@babel/polyfill": "^7.12.1",
Expand All @@ -126,7 +126,7 @@
"aws-sdk": "^2.290.0",
"babel-loader": "^8.0.2",
"chalk": "^3.0.0",
"debug": "^4.1.1",
"debug": "^4.3.4",
"dockerode": "^2.5.3",
"fs-extra": "^8.1.0",
"glob": "^7.1.2",
Expand All @@ -139,7 +139,7 @@
"string-replace-loader": "^2.1.1",
"supertest": "^4.0.1",
"supports-color": "^7.0.0",
"terser-webpack-plugin": "^2.0.0",
"terser-webpack-plugin": "^2.3.8",
"tmp-promise": "^2.0.1",
"unzipper": "^0.10.0",
"uuid": "^3.3.2",
Expand Down
12 changes: 9 additions & 3 deletions src/utils/logging.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import createDebug, { Debugger } from 'debug';
import createDebug, { Debugger, debug } from 'debug';

const libName = 'lambda-tools';

Expand All @@ -23,7 +23,10 @@ interface LoggerExtension {
function extendLogger ({ logger, name, enabled, log }: LoggerExtension): Debugger {
const childLogger: Debugger = logger.extend(name);
childLogger.log = log || logger.log;
childLogger.enabled = enabled || logger.enabled;
if (enabled || logger.enabled) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old approach of explicitly enabling logging on a single logger broke with the upgraded debug package

debug.names.push(new RegExp(`^${childLogger.namespace}$`))
}

return childLogger;
}

Expand All @@ -35,7 +38,10 @@ function createChildLogger (name: string, root: Debugger): Logger {
debug: extendLogger({ logger: root, name: 'debug', log: consoleLog, enabled: root.enabled }),
child: (name: string) => {
const child = root.extend(name);
child.enabled = root.enabled;
if (root.enabled) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old approach of explicitly enabling logging on a single logger broke with the upgraded debug package

debug.names.push(new RegExp(`^${child.namespace}$`))
}

return createChildLogger(name, child);
}
};
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"skipLibCheck": true,
"declaration": true,
"outDir": "./dist",
"allowJs": true
"allowJs": true,
},
"include": ["src/**/*", "bin/*"],
"exclude": ["node_modules", "src/patches/*.js"]
Expand Down
Loading