@@ -146,6 +146,12 @@ export class CardanoNode {
146146 */
147147 _cardanoWalletLogFile : WriteStream ;
148148
149+ /**
150+ * Log file stream for cardano-wallet
151+ * @private
152+ */
153+ _mockTokenMetadataServerLogFile : WriteStream ;
154+
149155 /**
150156 * The TLS config that is generated by the cardano-node
151157 * on each startup and is broadcasted over ipc channel
@@ -305,41 +311,40 @@ export class CardanoNode {
305311 ) ;
306312
307313 return new Promise ( async ( resolve , reject ) => {
308- const nodeLogFile = rfs (
309- ( time ) => {
310- // The module works by writing to the one file name before it is rotated out.
311- if ( ! time ) return 'node.log' ;
312- const timestamp = moment . utc ( ) . format ( 'YYYYMMDDHHmmss' ) ;
313- return `node.log-${ timestamp } ` ;
314- } ,
315- {
316- size : '5M' ,
317- path : this . _config . logFilePath ,
318- maxFiles : 4 ,
319- }
320- ) ;
314+ const mkLogFile = ( baseName : string ) : WriteStream => {
315+ return rfs (
316+ ( time ) => {
317+ // The module works by writing to the one file name before it is rotated out.
318+ if ( ! time ) return baseName ;
319+ const timestamp = moment . utc ( ) . format ( 'YYYYMMDDHHmmss' ) ;
320+ return `${ baseName } -${ timestamp } ` ;
321+ } ,
322+ {
323+ size : '5M' ,
324+ path : this . _config . logFilePath ,
325+ maxFiles : 4 ,
326+ }
327+ ) ;
328+ } ;
329+
330+ const nodeLogFile = mkLogFile ( 'node.log' ) ;
321331 this . _cardanoNodeLogFile = nodeLogFile ;
322- const walletLogFile = rfs (
323- ( time ) => {
324- // The module works by writing to the one file name before it is rotated out.
325- if ( ! time ) return 'cardano-wallet.log' ;
326- const timestamp = moment . utc ( ) . format ( 'YYYYMMDDHHmmss' ) ;
327- return `cardano-wallet.log-${ timestamp } ` ;
328- } ,
329- {
330- size : '5M' ,
331- path : this . _config . logFilePath ,
332- maxFiles : 4 ,
333- }
334- ) ;
332+ const walletLogFile = mkLogFile ( 'cardano-wallet.log' ) ;
335333 this . _cardanoWalletLogFile = walletLogFile ;
336334
337335 if ( isSelfnode ) {
338336 try {
337+ const mockTokenMetadataServerLogFile = mkLogFile (
338+ 'mock-token-metadata-server.log'
339+ ) ;
340+ this . _mockTokenMetadataServerLogFile = mockTokenMetadataServerLogFile ;
341+
339342 const { selfnodeBin, mockTokenMetadataServerBin } = launcherConfig ;
340343 const { node, replyPort } = await CardanoSelfnodeLauncher ( {
341344 selfnodeBin,
345+ walletLogFile,
342346 mockTokenMetadataServerBin,
347+ mockTokenMetadataServerLogFile,
343348 processName : CARDANO_PROCESS_NAME ,
344349 onStop : this . _ensureProcessIsNotRunning ,
345350 } ) ;
@@ -856,6 +861,8 @@ export class CardanoNode {
856861 _reset = ( ) => {
857862 if ( this . _cardanoNodeLogFile ) this . _cardanoNodeLogFile . end ( ) ;
858863 if ( this . _cardanoWalletLogFile ) this . _cardanoWalletLogFile . end ( ) ;
864+ if ( this . _mockTokenMetadataServerLogFile )
865+ this . _mockTokenMetadataServerLogFile . end ( ) ;
859866 if ( this . _node ) this . _node = null ;
860867 this . _tlsConfig = null ;
861868 } ;
0 commit comments