Winston 3 upgrade (#5496)

*  Release 3.1.3 (#5267)

*  Release 3.1.3

* Update CHANGELOG.md

* ⬆️ Bump winston and winston-daily-rotate-file

Bumps [winston](https://github.com/winstonjs/winston) and [winston-daily-rotate-file](https://github.com/winstonjs/winston-daily-rotate-file). These dependencies needed to be updated together.

Updates `winston` from 2.4.4 to 3.1.0
- [Release notes](https://github.com/winstonjs/winston/releases)
- [Changelog](https://github.com/winstonjs/winston/blob/master/CHANGELOG.md)
- [Commits](https://github.com/winstonjs/winston/compare/2.4.4...3.1.0)

Updates `winston-daily-rotate-file` from 1.7.2 to 3.5.1
- [Release notes](https://github.com/winstonjs/winston-daily-rotate-file/releases)
- [Commits](https://github.com/winstonjs/winston-daily-rotate-file/compare/v1.7.2...v3.5.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Rewrote WinstonLogger to work with winston 3.x api

* Changed winston logger test to use winston-transport

* Added winston-transport dependency

* Close and remove transports before adding them again

* Changed to strict equal

* Override adapter name

* Updated and added getLogs tests

* Bump winston and winston-daily-rotate-file

Bumps [winston](https://github.com/winstonjs/winston) and [winston-daily-rotate-file](https://github.com/winstonjs/winston-daily-rotate-file). These dependencies needed to be updated together.

Updates `winston` from 2.4.4 to 3.2.0
- [Release notes](https://github.com/winstonjs/winston/releases)
- [Changelog](https://github.com/winstonjs/winston/blob/master/CHANGELOG.md)
- [Commits](https://github.com/winstonjs/winston/compare/2.4.4...3.2.0)

Updates `winston-daily-rotate-file` from 1.7.2 to 3.6.0
- [Release notes](https://github.com/winstonjs/winston-daily-rotate-file/releases)
- [Commits](https://github.com/winstonjs/winston-daily-rotate-file/compare/v1.7.2...v3.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Fixed tests, updated parse logging

* Fixed tests, better error logging

* Fix failing tests

* Updates as per review
This commit is contained in:
Sam Ilic
2019-04-15 09:03:33 +10:00
committed by Arthur Cinader
parent 943134812e
commit 6ffc41345f
14 changed files with 1018 additions and 1010 deletions

View File

@@ -44,7 +44,7 @@ describe('LoggerController', () => {
done();
});
it('can process an ascending query without throwing', done => {
it('can parse an ascending query without throwing', done => {
// Make mock request
const query = {
from: '2016-01-01Z00:00:00',
@@ -65,11 +65,59 @@ describe('LoggerController', () => {
done();
});
it('can process an ascending query without throwing', done => {
// Make mock request
const query = {
from: '2016-01-01Z00:00:00',
until: '2016-01-01Z00:00:00',
size: 5,
order: 'asc',
level: 'error',
};
const loggerController = new LoggerController(new WinstonLoggerAdapter());
expect(() => {
loggerController
.getLogs(query)
.then(function(res) {
expect(res.length).not.toBe(0);
done();
})
.catch(err => {
jfail(err);
fail('should not fail');
done();
});
}).not.toThrow();
});
it('can parse a descending query without throwing', done => {
// Make mock request
const query = {
from: '2016-01-01Z00:00:00',
until: '2016-01-01Z00:00:00',
size: 5,
order: 'desc',
level: 'error',
};
const result = LoggerController.parseOptions(query);
expect(result.from.getTime()).toEqual(1451606400000);
expect(result.until.getTime()).toEqual(1451606400000);
expect(result.size).toEqual(5);
expect(result.order).toEqual('desc');
expect(result.level).toEqual('error');
done();
});
it('can process a descending query without throwing', done => {
// Make mock request
const query = {
from: '2016-01-01',
until: '2016-01-30',
from: '2016-01-01Z00:00:00',
until: '2016-01-01Z00:00:00',
size: 5,
order: 'desc',
level: 'error',
@@ -81,7 +129,7 @@ describe('LoggerController', () => {
loggerController
.getLogs(query)
.then(function(res) {
expect(res.length).toBe(0);
expect(res.length).not.toBe(0);
done();
})
.catch(err => {