File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,15 @@ describe(`logger (${
6565 } ) ;
6666 sandbox . restore ( ) ; // to avoid swallowing test runner output
6767 } ) ;
68+
69+ it ( 'should not recognize null as a structured logging object' , ( ) => {
70+ logger . log ( 'hello' , 'world' , null ) ;
71+ expectStdout ( {
72+ severity : 'INFO' ,
73+ message : 'hello world null' ,
74+ } ) ;
75+ sandbox . restore ( ) ; // to avoid swallowing test runner output
76+ } ) ;
6877 } ) ;
6978
7079 describe ( 'write' , ( ) => {
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ export function error(...args: any[]) {
104104function entryFromArgs ( severity : LogSeverity , args : any [ ] ) : LogEntry {
105105 let entry = { } ;
106106 const lastArg = args [ args . length - 1 ] ;
107- if ( typeof lastArg == 'object' && lastArg . constructor == Object ) {
107+ if ( lastArg && typeof lastArg == 'object' && lastArg . constructor == Object ) {
108108 entry = args . pop ( ) ;
109109 }
110110 return Object . assign ( { } , entry , {
You can’t perform that action at this time.
0 commit comments