Skip to content

Commit ca5364b

Browse files
committed
refactor: minimize logging code
Pull global format function into construction of memoized object directly.
1 parent 3d9df90 commit ca5364b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/function-value-plugin.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@ const defaultVariableResolverOptions = {
66
isDisabledAtPrepopulation: true
77
};
88

9-
const format = (value, result) =>
10-
`[${name}] \${${value}} => ${JSON.stringify(result)}`;
11-
129
export class FunctionValuePlugin {
1310
constructor(serverless) {
1411
if (!process.env.SLS_DEBUG) {
1512
this._log = () => { };
1613
} else {
17-
const log = (value, result) => serverless.cli.log(format(value, result));
18-
19-
this._log = memoize(log);
14+
this._log = memoize((value, result) => serverless.cli.log(
15+
`[${name}] \${${value}} => ${JSON.stringify(result)}`
16+
));
2017
}
2118

2219
this._naming = serverless.getProvider('aws').naming;

0 commit comments

Comments
 (0)