Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/logger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void describe( 'src/logger', async () => {
assert( typeof message === 'string', 'Expected log message to be a string' );
match(
message,
/^\w{3}, \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} GMT go:app {"message":"my message","level":"info","app":"go","app_type":"app","message_type":"info","app_process":"master","app_worker":"master"}$/
/^go:app {"message":"my message","level":"info","app":"go","app_type":"app","message_type":"info","app_process":"master","app_worker":"master"}$/
);
} );
} );
Expand Down
9 changes: 3 additions & 6 deletions src/logger/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import nodeCluster from 'node:cluster';
import { createLogger, format, transports } from 'winston';
import { createLogger, format, transports, type Logger } from 'winston';

import type { ClusterLike, LoggerOptions } from './types';
import type { TransformableInfo } from 'logform';
import type { Logger } from 'winston';

const { combine, timestamp, printf, splat } = format;

Expand Down Expand Up @@ -69,14 +68,12 @@ const localLoggingFormat = printf( output => {
// Logging format for production
const prodLoggingFormat = printf( output => {
const logOutput = output as LogEntry;
const { timestamp: time, app, app_type: type } = logOutput;
const { app, app_type: type } = logOutput;

// Can't include the timestamp in the JSON
delete logOutput.timestamp;

return `${ String( time ) } ${ String( app ) }:${ String( type ) } ${ JSON.stringify(
logOutput
) }`;
return `${ String( app ) }:${ String( type ) } ${ JSON.stringify( logOutput ) }`;
} );

function createGoLogger(
Expand Down