@@ -35,7 +35,12 @@ const {transports} = winston;
3535let output = [ ]
3636const stream = new Writable ( )
3737stream . _write = ( chunk , encoding , next ) => {
38- output . unshift ( chunk . toString ( ) . replace ( '\n' , '' ) ) ;
38+ let formatString = chunk . toString ( ) . replace ( '\n' , '<br />' )
39+ . replace ( / ( d e b u g ) / gi, '<span class="debug text-pink-400">$1</span>' )
40+ . replace ( / ( w a r n ) / gi, '<span class="warn text-blue-400">$1</span>' )
41+ . replace ( / ( i n f o ) / gi, '<span class="info text-yellow-500">$1</span>' )
42+ . replace ( / ( e r r o r ) / gi, '<span class="error text-red-400">$1</span>' )
43+ output . unshift ( formatString ) ;
3944 output = output . slice ( 0 , 101 ) ;
4045 next ( )
4146}
@@ -198,9 +203,9 @@ app.use(bodyParser.json());
198203 clients : clientData ,
199204 logs : {
200205 output : slicedLog ,
201- limit : [ 10 , 20 , 50 , 100 ] . map ( x => `<a class="capitalize ${ logConfig . limit === x ? 'bold' : '' } " href="logs/settings/update?limit=${ x } ">${ x } </a>` ) . join ( ' | ' ) ,
202- sort : [ 'ascending' , 'descending' ] . map ( x => `<a class="capitalize ${ logConfig . sort === x ? 'bold' : '' } " href="logs/settings/update?sort=${ x } ">${ x } </a>` ) . join ( ' | ' ) ,
203- level : availableLevels . map ( x => `<a class="capitalize ${ logConfig . level === x ? 'bold' : '' } " href="logs/settings/update?level=${ x } ">${ x } </a>` ) . join ( ' | ' )
206+ limit : [ 10 , 20 , 50 , 100 ] . map ( x => `<a class="capitalize ${ logConfig . limit === x ? 'font- bold no-underline pointer-events-none ' : '' } " href="logs/settings/update?limit=${ x } ">${ x } </a>` ) . join ( ' | ' ) ,
207+ sort : [ 'ascending' , 'descending' ] . map ( x => `<a class="capitalize ${ logConfig . sort === x ? 'font- bold no-underline pointer-events-none ' : '' } " href="logs/settings/update?sort=${ x } ">${ x } </a>` ) . join ( ' | ' ) ,
208+ level : availableLevels . map ( x => `<a class="capitalize ${ logConfig . level === x ? 'font- bold no-underline pointer-events-none ' : '' } " href="logs/settings/update?level=${ x } ">${ x } </a>` ) . join ( ' | ' )
204209 }
205210 } ) ;
206211 } )
0 commit comments