@@ -262,7 +262,9 @@ private void onopen() {
262262 }
263263
264264 private void onclose (String reason ) {
265- logger .fine (String .format ("close (%s)" , reason ));
265+ if (logger .isLoggable (Level .FINE )) {
266+ logger .fine (String .format ("close (%s)" , reason ));
267+ }
266268 this .connected = false ;
267269 this .id = null ;
268270 this .emit (EVENT_DISCONNECT , reason );
@@ -316,7 +318,9 @@ private void onpacket(Packet<?> packet) {
316318
317319 private void onevent (Packet <JSONArray > packet ) {
318320 List <Object > args = new ArrayList <Object >(Arrays .asList (toArray (packet .data )));
319- logger .fine (String .format ("emitting event %s" , args ));
321+ if (logger .isLoggable (Level .FINE )) {
322+ logger .fine (String .format ("emitting event %s" , args ));
323+ }
320324
321325 if (packet .id >= 0 ) {
322326 logger .fine ("attaching ack callback to event" );
@@ -343,7 +347,9 @@ public void call(final Object... args) {
343347 public void run () {
344348 if (sent [0 ]) return ;
345349 sent [0 ] = true ;
346- logger .fine (String .format ("sending ack %s" , args .length != 0 ? args : null ));
350+ if (logger .isLoggable (Level .FINE )) {
351+ logger .fine (String .format ("sending ack %s" , args .length != 0 ? args : null ));
352+ }
347353
348354 JSONArray jsonArgs = new JSONArray ();
349355 for (Object arg : args ) {
@@ -362,10 +368,14 @@ public void run() {
362368 private void onack (Packet <JSONArray > packet ) {
363369 Ack fn = this .acks .remove (packet .id );
364370 if (fn != null ) {
365- logger .fine (String .format ("calling ack %s with %s" , packet .id , packet .data ));
371+ if (logger .isLoggable (Level .FINE )) {
372+ logger .fine (String .format ("calling ack %s with %s" , packet .id , packet .data ));
373+ }
366374 fn .call (toArray (packet .data ));
367375 } else {
368- logger .fine (String .format ("bad ack %s" , packet .id ));
376+ if (logger .isLoggable (Level .FINE )) {
377+ logger .fine (String .format ("bad ack %s" , packet .id ));
378+ }
369379 }
370380 }
371381
@@ -391,7 +401,9 @@ private void emitBuffered() {
391401 }
392402
393403 private void ondisconnect () {
394- logger .fine (String .format ("server disconnect (%s)" , this .nsp ));
404+ if (logger .isLoggable (Level .FINE )) {
405+ logger .fine (String .format ("server disconnect (%s)" , this .nsp ));
406+ }
395407 this .destroy ();
396408 this .onclose ("io server disconnect" );
397409 }
@@ -418,7 +430,9 @@ public Socket close() {
418430 @ Override
419431 public void run () {
420432 if (Socket .this .connected ) {
421- logger .fine (String .format ("performing disconnect (%s)" , Socket .this .nsp ));
433+ if (logger .isLoggable (Level .FINE )) {
434+ logger .fine (String .format ("performing disconnect (%s)" , Socket .this .nsp ));
435+ }
422436 Socket .this .packet (new Packet (Parser .DISCONNECT ));
423437 }
424438
0 commit comments