Skip to content

Commit

Permalink
🔊 oo-connector: output JSON logs in production (#740)
Browse files Browse the repository at this point in the history
if NODE_ENV=production, then log in JSON format
  • Loading branch information
ericlinagora authored Nov 25, 2024
2 parents f12f089 + 33e88bb commit 1481a0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tdrive/connectors/onlyoffice-connector/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const {
OOCONNECTOR_HEALTH_SECRET,
} = process.env;

export const isProductionEnv = (NODE_ENV ?? '').toLocaleLowerCase().trim() === 'production';

const secs = 1000,
mins = 60 * secs;

Expand Down
2 changes: 2 additions & 0 deletions tdrive/connectors/onlyoffice-connector/src/lib/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Logger } from 'tslog';
import { isProductionEnv } from '../config';

export default new Logger({
name: 'twake-onlyoffice-plugin',
type: isProductionEnv ? 'json' : 'pretty',
});

0 comments on commit 1481a0c

Please sign in to comment.