@@ -31,29 +31,27 @@ window.addEventListener('DOMContentLoaded', () => {
3131 _warn = console . warn ,
3232 _error = console . error ;
3333
34- const dispatchConsoleEvent = ( type , message ) => {
34+ const dispatchConsoleEvent = ( type , arguments ) => {
3535 window . dispatchEvent ( new CustomEvent ( 'console' , {
3636 detail : {
3737 type,
38- message
38+ message : Object . values ( arguments ) . join ( ' ' )
3939 }
4040 } ) ) ;
4141 }
4242
43- // TODO: is there an easy way to capture all args?
44- // maybe turn vals into array, then do .join(' ')?
4543 console . log = function ( ) {
46- dispatchConsoleEvent ( 'log' , arguments [ 0 ] ) ;
44+ dispatchConsoleEvent ( 'log' , arguments ) ;
4745 return _log . apply ( console , arguments ) ;
4846 } ;
4947
5048 console . warn = function ( ) {
51- dispatchConsoleEvent ( 'warning' , arguments [ 0 ] ) ;
49+ dispatchConsoleEvent ( 'warning' , arguments ) ;
5250 return _warn . apply ( console , arguments ) ;
5351 } ;
5452
5553 console . error = function ( ) {
56- dispatchConsoleEvent ( 'error' , arguments [ 0 ] ) ;
54+ dispatchConsoleEvent ( 'error' , arguments ) ;
5755 return _error . apply ( console , arguments ) ;
5856 } ;
5957
0 commit comments