Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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',