1. Project Clover database Wed Jan 17 2024 23:40:18 CST
  2. Package org.europa.together.business

File Logger.java

 

Code metrics

0
0
0
1
54
17
0
-
-
0
-

Classes

Class Line # Actions
Logger 17 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package org.europa.together.business;
2   
3    import org.apiguardian.api.API;
4    import static org.apiguardian.api.API.Status.STABLE;
5    import org.europa.together.domain.LogLevel;
6    import org.springframework.stereotype.Component;
7   
8    /**
9    * Simple API for application logging.
10    *
11    * @author elmar.dott@gmail.com
12    * @version 1.2
13    * @since 1.0
14    */
15    @API(status = STABLE, since = "1.0", consumers = "LogbackLogger")
16    @Component
 
17    public interface Logger {
18   
19    /**
20    * Identifier for the given feature.
21    */
22    @API(status = STABLE, since = "1.2")
23    String FEATURE_ID = "CM-01";
24   
25    /**
26    * Create a log entry with the given message for the configured LogLevel.
27    * Log-Level: TRACE | DEBUG | INFO | WARN | ERROR
28    *
29    * @param message as String.
30    * @param level as LogLevel.
31    * @return LogLevel
32    */
33    @API(status = STABLE, since = "1.0")
34    LogLevel log(String message, LogLevel level);
35   
36    /**
37    * Get the configured LogLevel for the Logger.
38    *
39    * @return LogLevel
40    */
41    @API(status = STABLE, since = "1.0")
42    LogLevel getConfiguredLogLevel();
43   
44    /**
45    * Modified method to log exceptions. The output will be the exception name
46    * and the exception message in the LogLevel ERROR. In the case a
47    * NullPointerException is thrown, the StackTrace will be logged too.
48    *
49    * @param ex as Exception
50    * @return exception message as String
51    */
52    @API(status = STABLE, since = "1.0")
53    String catchException(Exception ex);
54    }