@@ -283,7 +283,9 @@ private void onopen() {
283283 }
284284
285285 private void onclose (String reason ) {
286- logger .fine (String .format ("close (%s)" , reason ));
286+ if (logger .isLoggable (Level .FINE )) {
287+ logger .fine (String .format ("close (%s)" , reason ));
288+ }
287289 this .connected = false ;
288290 this .id = null ;
289291 this .emit (EVENT_DISCONNECT , reason );
@@ -337,7 +339,9 @@ private void onpacket(Packet<?> packet) {
337339
338340 private void onevent (Packet <JSONArray > packet ) {
339341 List <Object > args = new ArrayList <Object >(Arrays .asList (toArray (packet .data )));
340- logger .fine (String .format ("emitting event %s" , args ));
342+ if (logger .isLoggable (Level .FINE )) {
343+ logger .fine (String .format ("emitting event %s" , args ));
344+ }
341345
342346 if (packet .id >= 0 ) {
343347 logger .fine ("attaching ack callback to event" );
@@ -364,7 +368,9 @@ public void call(final Object... args) {
364368 public void run () {
365369 if (sent [0 ]) return ;
366370 sent [0 ] = true ;
367- logger .fine (String .format ("sending ack %s" , args .length != 0 ? args : null ));
371+ if (logger .isLoggable (Level .FINE )) {
372+ logger .fine (String .format ("sending ack %s" , args .length != 0 ? args : null ));
373+ }
368374
369375 JSONArray jsonArgs = new JSONArray ();
370376 for (Object arg : args ) {
@@ -385,10 +391,14 @@ public void run() {
385391 private void onack (Packet <JSONArray > packet ) {
386392 Ack fn = this .acks .remove (packet .id );
387393 if (fn != null ) {
388- logger .fine (String .format ("calling ack %s with %s" , packet .id , packet .data ));
394+ if (logger .isLoggable (Level .FINE )) {
395+ logger .fine (String .format ("calling ack %s with %s" , packet .id , packet .data ));
396+ }
389397 fn .call (toArray (packet .data ));
390398 } else {
391- logger .fine (String .format ("bad ack %s" , packet .id ));
399+ if (logger .isLoggable (Level .FINE )) {
400+ logger .fine (String .format ("bad ack %s" , packet .id ));
401+ }
392402 }
393403 }
394404
@@ -414,7 +424,9 @@ private void emitBuffered() {
414424 }
415425
416426 private void ondisconnect () {
417- logger .fine (String .format ("server disconnect (%s)" , this .nsp ));
427+ if (logger .isLoggable (Level .FINE )) {
428+ logger .fine (String .format ("server disconnect (%s)" , this .nsp ));
429+ }
418430 this .destroy ();
419431 this .onclose ("io server disconnect" );
420432 }
@@ -441,7 +453,9 @@ public Socket close() {
441453 @ Override
442454 public void run () {
443455 if (Socket .this .connected ) {
444- logger .fine (String .format ("performing disconnect (%s)" , Socket .this .nsp ));
456+ if (logger .isLoggable (Level .FINE )) {
457+ logger .fine (String .format ("performing disconnect (%s)" , Socket .this .nsp ));
458+ }
445459 Socket .this .packet (new Packet (Parser .DISCONNECT ));
446460 }
447461
0 commit comments