@@ -26,12 +26,12 @@ export type LogFormat = 'json' | 'pretty-timestamped' | 'pretty';
26
26
export function createLogger (
27
27
options = { level : 'http' } ,
28
28
destination = pino . destination ( 1 ) ,
29
- format : LogFormat = DEFAULT_LOG_FORMAT ,
30
29
prettyPrintOptions = {
31
30
// we hide warning since the prettifier should not be used in production
32
31
// https://getpino.io/#/docs/pretty?id=prettifier-api
33
32
suppressFlushSyncWarning : true ,
34
- }
33
+ } ,
34
+ format : LogFormat = DEFAULT_LOG_FORMAT
35
35
) {
36
36
if ( _ . isNil ( format ) ) {
37
37
format = DEFAULT_LOG_FORMAT ;
@@ -116,19 +116,11 @@ export type LoggerConfigItem = {
116
116
level ?: string ;
117
117
} ;
118
118
119
- export type LoggerConfig = LoggerConfigItem [ ] ;
119
+ export type LoggerConfig = LoggerConfigItem ;
120
120
121
- export function setup ( options : LoggerConfig | LoggerConfigItem = DEFAULT_LOGGER_CONF ) {
121
+ export function setup ( options : LoggerConfigItem = DEFAULT_LOGGER_CONF ) {
122
122
debug ( 'setup logger' ) ;
123
- const isLegacyConf = Array . isArray ( options ) ;
124
- if ( isLegacyConf ) {
125
- warningUtils . emit ( warningUtils . Codes . VERDEP002 ) ;
126
- }
127
-
128
- // verdaccio 5 does not allow multiple logger configuration
129
- // backward compatible, pick only the first option
130
- // next major will thrown an error
131
- let loggerConfig = isLegacyConf ? options [ 0 ] : options ;
123
+ let loggerConfig = options ;
132
124
if ( ! loggerConfig ?. level ) {
133
125
loggerConfig = Object . assign (
134
126
{ } ,
@@ -143,13 +135,17 @@ export function setup(options: LoggerConfig | LoggerConfigItem = DEFAULT_LOGGER_
143
135
debug ( 'logging file enabled' ) ;
144
136
const destination = pino . destination ( loggerConfig . path ) ;
145
137
process . on ( 'SIGUSR2' , ( ) => destination . reopen ( ) ) ;
138
+ // @ts -ignore
146
139
logger = createLogger ( pinoConfig , destination , loggerConfig . format ) ;
140
+ // @ts -ignore
147
141
} else if ( loggerConfig . type === 'rotating-file' ) {
148
142
warningUtils . emit ( warningUtils . Codes . VERWAR003 ) ;
149
143
debug ( 'logging stdout enabled' ) ;
144
+ // @ts -ignore
150
145
logger = createLogger ( pinoConfig , pino . destination ( 1 ) , loggerConfig . format ) ;
151
146
} else {
152
147
debug ( 'logging stdout enabled' ) ;
148
+ // @ts -ignore
153
149
logger = createLogger ( pinoConfig , pino . destination ( 1 ) , loggerConfig . format ) ;
154
150
}
155
151
0 commit comments