Commit eabd5f45 authored by Rostislav Vatolin [SLB]'s avatar Rostislav Vatolin [SLB] Committed by Hema Vishnu Pola [Microsoft]
Browse files

Upgrade os-core-common library

parent aed73caa
......@@ -37,7 +37,7 @@
<azure.appinsights.log4j.version>2.6.3</azure.appinsights.log4j.version>
<azure.spring.boot.version>3.4.0</azure.spring.boot.version>
<lombok.version>1.18.16</lombok.version>
<osdu.oscorecommon.version>0.9.0-rc7</osdu.oscorecommon.version>
<osdu.oscorecommon.version>0.9.0-rc13</osdu.oscorecommon.version>
<azure-mgmt-eventgrid.version>1.0.0-beta-3</azure-mgmt-eventgrid.version>
<azure-security-keyvault-keys.version>4.2.3</azure-security-keyvault-keys.version>
<documentdb-bulkexecutor.version>2.12.0</documentdb-bulkexecutor.version>
......
......@@ -46,6 +46,27 @@ public class CoreLogger implements ICoreLogger {
this.logger.info(format, arguments);
}
/**
* Log a message at the DEBUG level.
*
* @param msg the message string to be logged
*/
@Override
public void debug(final String msg) {
this.logger.debug(msg);
}
/**
* Log a message at the DEBUG level according to the specified format and arguments.
*
* @param format the format string
* @param arguments a list of arguments
*/
@Override
public void debug(final String format, final Object... arguments) {
this.logger.debug(format, arguments);
}
/**
* Log a message at the WARN level.
*
......
......@@ -21,6 +21,21 @@ public interface ICoreLogger {
*/
void info(String format, Object... arguments);
/**
* Log a message at the INFO level.
*
* @param msg the message string to be logged
*/
void debug(String msg);
/**
* Log a message at the INFO level according to the specified format and arguments.
*
* @param format the format string
* @param arguments a list of arguments
*/
void debug(String format, Object... arguments);
/**
* Log a message at the WARN level.
*
......
......@@ -70,6 +70,17 @@ public final class Slf4JLogger implements ILogger {
this.headersToLog.createStandardLabelsFromMap(headers));
}
@Override
public void debug(final String logPrefix, final String message, final Map<String, String> headers) {
this.debug(DEFAULT_LOGGER_NAME, logPrefix, message, headers);
}
@Override
public void debug(final String loggerName, final String logPrefix, final String message, final Map<String, String> headers) {
CoreLoggerFactory.getInstance().getLogger(loggerName).debug("{} {} {}", logPrefix, message,
this.headersToLog.createStandardLabelsFromMap(headers));
}
@Override
public void warning(final String logPrefix, final String message, final Map<String, String> headers) {
this.warning(DEFAULT_LOGGER_NAME, logPrefix, message, headers);
......
......@@ -55,6 +55,18 @@ public class CoreLoggerTest {
verify(spySlf4jLogger).info("{} {} {}", ARG1, ARG2, ARG3);
}
@Test
public void testDebugWithMessage() {
coreLogger.debug(LOG_MESSAGE);
verify(spySlf4jLogger).debug(LOG_MESSAGE);
}
@Test
public void testDebugWithArguments() {
coreLogger.debug("{} {} {}", ARG1, ARG2, ARG3);
verify(spySlf4jLogger).debug("{} {} {}", ARG1, ARG2, ARG3);
}
@Test
public void testWarnWithMessage() {
coreLogger.warn(LOG_MESSAGE);
......
......@@ -160,6 +160,24 @@ public class Slf4JLoggerTest {
verify(headersToLog, times(1)).createStandardLabelsFromMap(eq(headers));
}
@Test
public void testDebug() {
doNothing().when(coreLogger).debug(eq("{} {} {}"), eq(LOG_PREFIX), eq(LOG_MESSAGE), eq(headers));
slf4JLogger.debug(LOG_PREFIX, LOG_MESSAGE, headers);
verify(coreLogger, times(1)).debug(eq("{} {} {}"), eq(LOG_PREFIX), eq(LOG_MESSAGE), eq(headers));
verify(coreLoggerFactory, times(1)).getLogger(eq(DEFAULT_LOGGER_NAME));
verify(headersToLog, times(1)).createStandardLabelsFromMap(eq(headers));
}
@Test
public void testDebugWithLoggerName() {
doNothing().when(coreLogger).debug(eq("{} {} {}"), eq(LOG_PREFIX), eq(LOG_MESSAGE), eq(headers));
slf4JLogger.debug(LOGGER_NAME, LOG_PREFIX, LOG_MESSAGE, headers);
verify(coreLogger, times(1)).debug(eq("{} {} {}"), eq(LOG_PREFIX), eq(LOG_MESSAGE), eq(headers));
verify(coreLoggerFactory, times(1)).getLogger(eq(LOGGER_NAME));
verify(headersToLog, times(1)).createStandardLabelsFromMap(eq(headers));
}
@Test
public void testWarning() {
doNothing().when(coreLogger).warn(eq("{} {} {}"), eq(LOG_PREFIX), eq(LOG_MESSAGE), eq(headers));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment