-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: #98 In the VocabularyTopExporter hierarchy, return loggerName a…
…nd use a single LoggerWrapper that will append this loggerName to the logs.
- Loading branch information
1 parent
0c2c981
commit ed1a241
Showing
22 changed files
with
122 additions
and
66 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
kgstatsSrv/src/main/java/ru/klavogonki/statistics/export/LoggerWrapper.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,41 @@ | ||
package ru.klavogonki.statistics.export; | ||
|
||
import lombok.extern.log4j.Log4j2; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
@Log4j2 | ||
public class LoggerWrapper { | ||
|
||
private final Logger internalLogger; | ||
private final String loggerPrefix; | ||
private final String loggerPrefixFull; | ||
|
||
public LoggerWrapper(Logger internalLogger, String loggerPrefix) { | ||
this.internalLogger = internalLogger; | ||
this.loggerPrefix = loggerPrefix; | ||
this.loggerPrefixFull = String.format("[%s]: ", loggerPrefix); | ||
|
||
logger.info("LoggerWrapper initialized for loggerPrefix = \"{}\".", loggerPrefix); | ||
} | ||
|
||
private String formatMessage(String message) { // appends prefix | ||
// todo: maybe String.format will work for message as well, but let's not risk | ||
return loggerPrefixFull + message; | ||
} | ||
|
||
public void debug(String message, Object p0) { | ||
internalLogger.debug(formatMessage(message), p0); | ||
} | ||
|
||
public void debug(String message, Object p0, Object p1) { | ||
internalLogger.debug(formatMessage(message), p0, p1); | ||
} | ||
|
||
public void warn(String message, Object p0) { | ||
internalLogger.warn(formatMessage(message), p0); | ||
} | ||
|
||
public void warn(String message, Object p0, Object p1) { | ||
internalLogger.warn(formatMessage(message), p0, p1); | ||
} | ||
} |
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
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
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
Oops, something went wrong.