Skip to content

Commit

Permalink
Merge pull request #61 from Olian04/dev
Browse files Browse the repository at this point in the history
4.5.1
  • Loading branch information
Olian04 authored Oct 12, 2021
2 parents 6e43a75 + adf51eb commit b801acf
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 45 deletions.
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ rollup.config.js
tsconfig.json
tslint.json
.github
.vscode
.vscode
.editorconfig
docs
9 changes: 0 additions & 9 deletions docs/index.rst

This file was deleted.

66 changes: 35 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "better-logging",
"version": "4.5.0",
"version": "4.5.1",
"description": "better-logging is a drop in replacement for the default logging methods of node.js",
"main": "./index.js",
"typings": "./dist/api.d.ts",
Expand All @@ -18,6 +18,9 @@
"lint": "tslint --fix -c ./tslint.json 'src/**/*.ts'",
"lint:nofix": "tslint -c ./tslint.json 'src/**/*.ts'"
},
"engines": {
"node": ">=12"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Olian04/better-logging.git"
Expand All @@ -42,7 +45,7 @@
"homepage": "https://github.com/Olian04/better-logging#readme",
"dependencies": {
"@olian/typescript-helpers": "^2.3.0",
"@types/node": "^14.14.35",
"@types/node": "^14.17.22",
"chalk": "^4.1.0",
"fast-safe-stringify": "^2.0.7"
},
Expand Down
7 changes: 6 additions & 1 deletion src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ export const resolveConfig = (config: PartialConfig) =>
DefaultConfig.format,
treatAsFalsy
),
saveToFile: useValueOrFallback(config, 'saveToFile', null, treatAsFalsy),
saveToFile: useValueOrFallback(
config,
'saveToFile',
DefaultConfig.saveToFile,
treatAsFalsy
),
color: !config.color
? DefaultConfig.color
: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/formatMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ export const formatMessage = (logType: LogType, config: Config, args: unknown[])
const formattingContext = constructFormattingContext(logType, config, rawMessage);
const formattedMessage = config.format(formattingContext);
return [formattedMessage, remainingArgs];
}
}
8 changes: 8 additions & 0 deletions test/unit-tests/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@ describe('Config', () => {

expect(config.format).to.equal(DefaultConfig.format);
});

it('Null Format Function', () => {
const config = resolveConfig({
format: null,
});

expect(config.format).to.equal(DefaultConfig.format);
});
});

0 comments on commit b801acf

Please sign in to comment.