Skip to content

Commit

Permalink
Merge 7937816 into 4bd47f8
Browse files Browse the repository at this point in the history
  • Loading branch information
ugolas committed May 2, 2020
2 parents 4bd47f8 + 7937816 commit 71b1d60
Show file tree
Hide file tree
Showing 7 changed files with 1,971 additions and 272 deletions.
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
language: node_js

node_js:
- "6"
- "8"
- "10"
- "12"
- "node"
script: "npm run-script test-travis"
after_success: 'npm run coveralls'

jobs:
include:
- language: node_js
node_js: node
script:
- nyc npm run test
after_success: "npm run coveralls"
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Removed support for objects configuration in array fields from [@ugolas](https://github.com/ugolas).
- Fixed vulnerabilities from [@ugolas](https://github.com/ugolas).
- Replaced coverage reporter from istanbul to nyc from [@ugolas](https://github.com/ugolas).
- Removed support for node 6 from [@ugolas](https://github.com/ugolas).
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Middleware for logging request/responses in Express apps
- Exclude response body fields
- Exclude response specific headers
- Exclude specific URLs from logging
- Supported by Node v6 and above.
- Supported by Node v8 and above.

## Installation

Expand Down
12 changes: 8 additions & 4 deletions lib/express-logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ module.exports = function (options) {
return audit;
};

//convert all options fields that need to be array by default
// Convert all options fields that need to be array by default
function validateArrayFields(options, defaults) {
Object.keys(flatten(options)).forEach((key) => {
let defaultsCopy = Object.assign({}, defaults);
delete defaultsCopy.logger;

Object.keys(flatten(defaultsCopy)).forEach((key) => {
let optionValue = _.get(options, key);
let defaultValue = _.get(defaults, key)
let defaultValue = _.get(defaultsCopy, key)
if (_.isArray(defaultValue) && !_.isArray(optionValue)) {
_.set(options, key, [optionValue]);
logger.warn(`Invalid value specified for field: ${key}, expected array. Value will be ignored`);
_.set(options, key, []);
}
});

Expand Down

0 comments on commit 71b1d60

Please sign in to comment.