-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FMWK-277 Set Aerospike client logger callback (#51)
- Loading branch information
Showing
8 changed files
with
91 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/com/aerospike/jdbc/util/AerospikeClientLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.aerospike.jdbc.util; | ||
|
||
import com.aerospike.client.Log; | ||
|
||
import java.util.logging.Logger; | ||
|
||
import static java.lang.String.format; | ||
|
||
public class AerospikeClientLogger implements Log.Callback { | ||
|
||
private static final Logger logger = Logger.getLogger(AerospikeClientLogger.class.getName()); | ||
|
||
@Override | ||
public void log(Log.Level level, String message) { | ||
switch (level) { | ||
case DEBUG: | ||
logger.fine(message); | ||
break; | ||
|
||
case INFO: | ||
logger.info(message); | ||
break; | ||
|
||
case WARN: | ||
logger.warning(message); | ||
break; | ||
|
||
case ERROR: | ||
logger.severe(message); | ||
break; | ||
|
||
default: | ||
logger.warning(() -> format("Unexpected Aerospike client log level %s. Message: %s", | ||
level, message)); | ||
} | ||
} | ||
} |