File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,15 @@ import pretty from 'pino-pretty';
33import { LOGS_FILEPATH } from './config/file' ;
44import { Environment } from './types' ;
55import { POLL } from './config/bot' ;
6+ import { version } from '../package.json' ;
7+
8+ const getBindings = ( bindings : pino . Bindings ) => {
9+ return {
10+ pid : bindings . pid ,
11+ hostname : bindings . hostname ,
12+ version,
13+ } ;
14+ }
615
716const getLoggerByEnvironment = ( env : Environment ) => {
817 switch ( env ) {
@@ -12,6 +21,9 @@ const getLoggerByEnvironment = (env: Environment) => {
1221 case Environment . Production :
1322 return pino ( {
1423 level : 'debug' ,
24+ formatters : {
25+ bindings : getBindings ,
26+ } ,
1527 transport : {
1628 target : 'pino-pretty' ,
1729 } ,
@@ -24,6 +36,9 @@ const getLoggerByUseCase = () => {
2436 if ( POLL ) {
2537 return pino ( {
2638 level : 'trace' ,
39+ formatters : {
40+ bindings : getBindings ,
41+ } ,
2742 } , pino . transport ( {
2843 targets : [ {
2944 level : 'info' ,
@@ -41,6 +56,9 @@ const getLoggerByUseCase = () => {
4156 // Otherwise, only terminal is sufficient
4257 return pino ( {
4358 level : 'debug' ,
59+ formatters : {
60+ bindings : getBindings ,
61+ } ,
4462 transport : {
4563 target : 'pino-pretty' ,
4664 } ,
You can’t perform that action at this time.
0 commit comments