@@ -15,6 +15,8 @@ const MulticastDNS = require('libp2p-mdns')
15
15
const WS = require ( 'libp2p-websockets' )
16
16
const Bootstrap = require ( 'libp2p-bootstrap' )
17
17
const errorHandler = require ( './error-handler' )
18
+ const LOG = 'ipfs:http-api'
19
+ const LOG_ERROR = 'ipfs:http-api:error'
18
20
19
21
function hapiInfoToMultiaddr ( info ) {
20
22
let hostname = info . host
@@ -48,8 +50,8 @@ function serverCreator (serverAddrs, createServer, ipfs) {
48
50
class HttpApi {
49
51
constructor ( options ) {
50
52
this . _options = options || { }
51
- this . _log = debug ( 'ipfs:http-api' )
52
- this . _log . error = debug ( 'ipfs:http-api:error' )
53
+ this . _log = debug ( LOG )
54
+ this . _log . error = debug ( LOG_ERROR )
53
55
54
56
if ( process . env . IPFS_MONITORING ) {
55
57
// Setup debug metrics collection
@@ -147,7 +149,7 @@ class HttpApi {
147
149
options : {
148
150
prettyPrint : process . env . NODE_ENV !== 'production' ,
149
151
logEvents : [ 'onPostStart' , 'onPostStop' , 'response' , 'request-error' ] ,
150
- level : process . env . DEBUG ? 'debug' : 'error'
152
+ level : debug . enabled ( LOG ) ? 'debug' : ( debug . enabled ( LOG_ERROR ) ? 'error' : 'fatal' )
151
153
}
152
154
} )
153
155
@@ -183,9 +185,9 @@ class HttpApi {
183
185
await server . register ( {
184
186
plugin : Pino ,
185
187
options : {
186
- prettyPrint : Boolean ( process . env . DEBUG ) ,
188
+ prettyPrint : Boolean ( debug . enabled ( LOG ) ) ,
187
189
logEvents : [ 'onPostStart' , 'onPostStop' , 'response' , 'request-error' ] ,
188
- level : process . env . DEBUG ? 'debug' : 'error'
190
+ level : debug . enabled ( LOG ) ? 'debug' : ( debug . enabled ( LOG_ERROR ) ? 'error' : 'fatal' )
189
191
}
190
192
} )
191
193
0 commit comments