Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAustin Schaffer <austin.schaffer@ryansg.com>2019-12-17 11:46:34 -0500
committerAustin Schaffer <austin.schaffer@ryansg.com>2019-12-17 11:59:06 -0500
commit699ee29a953b9b509979a503e70ae3a5fcf7ace7 (patch)
treefab1f2a4d21ddd4fd744b888d51320c170779109
parent542745da8a4c3a808ad8e692e335de4e5d9e9aba (diff)
downloadliza-699ee29a953b9b509979a503e70ae3a5fcf7ace7.tar.gz
liza-699ee29a953b9b509979a503e70ae3a5fcf7ace7.tar.bz2
liza-699ee29a953b9b509979a503e70ae3a5fcf7ace7.zip
[DEV-5312] Use formatted time when logging events
-rw-r--r--src/system/StandardLogger.ts7
-rw-r--r--test/system/EventMediatorTest.ts2
-rw-r--r--test/system/StandardLoggerTest.ts4
3 files changed, 8 insertions, 5 deletions
diff --git a/src/system/StandardLogger.ts b/src/system/StandardLogger.ts
index cdd062d..7bf762d 100644
--- a/src/system/StandardLogger.ts
+++ b/src/system/StandardLogger.ts
@@ -24,7 +24,7 @@ import { PsrLogger, LogLevel } from './PsrLogger';
declare type StructuredLog = {
message: string;
- timestamp: UnixTimestamp;
+ timestamp: string;
service: string;
env: string;
severity: string;
@@ -181,9 +181,12 @@ export class StandardLogger implements PsrLogger
str = msg;
}
+ const ts = this._ts_ctr();
+ const tsFormatted = new Date( ts * 1000 ).toISOString()
+
const structured_log = <StructuredLog>{
message: str,
- timestamp: this._ts_ctr(),
+ timestamp: tsFormatted,
service: 'quote-server',
env: this._env,
severity: LogLevel[level],
diff --git a/test/system/EventMediatorTest.ts b/test/system/EventMediatorTest.ts
index abfbef8..cf854b6 100644
--- a/test/system/EventMediatorTest.ts
+++ b/test/system/EventMediatorTest.ts
@@ -26,7 +26,7 @@ import { expect } from 'chai';
import { PsrLogger } from '../../src/system/PsrLogger';
-describe( 'system.EventLogger captures and logs events', () =>
+describe( 'system.EventMediator captures and logs events', () =>
{
it( 'document-processed triggers log#notice', () =>
{
diff --git a/test/system/StandardLoggerTest.ts b/test/system/StandardLoggerTest.ts
index 918bfd1..d655e0b 100644
--- a/test/system/StandardLoggerTest.ts
+++ b/test/system/StandardLoggerTest.ts
@@ -30,7 +30,7 @@ declare interface MockConsole extends Console {
getStr(): string,
}
-describe( 'system.EventLogger captures and logs events', () =>
+describe( 'system.StandardLogger captures and logs events', () =>
{
it( 'debug triggers console output level: info', () =>
{
@@ -139,7 +139,7 @@ describe( 'system.EventLogger captures and logs events', () =>
const context = { bar: 'baz' };
const expected_output = {
message: 'Foo',
- timestamp: 123123,
+ timestamp: '1970-01-02T10:12:03.000Z',
service: 'quote-server',
env: 'test',
severity: 'NOTICE',