|
23 | 23 | import java.util.Map; |
24 | 24 |
|
25 | 25 | import lombok.RequiredArgsConstructor; |
| 26 | +import lombok.extern.slf4j.Slf4j; |
26 | 27 | import org.springframework.beans.factory.InitializingBean; |
27 | 28 | import org.springframework.beans.factory.annotation.Autowired; |
28 | 29 | import org.springframework.beans.factory.annotation.Value; |
|
46 | 47 | * @since 0.3 |
47 | 48 | * @author daisuke |
48 | 49 | */ |
| 50 | +@Slf4j |
49 | 51 | @RequiredArgsConstructor |
50 | 52 | public class NotificationService implements InitializingBean { |
51 | 53 |
|
52 | | - private static Logger logger = LoggerFactory.getLogger(NotificationService.class); |
53 | | - |
54 | | - |
55 | 54 | /** |
56 | 55 | * Returns stacktrace as string. |
57 | 56 | * |
@@ -94,8 +93,8 @@ private static String toString(Throwable t) { |
94 | 93 |
|
95 | 94 | @Override |
96 | 95 | public void afterPropertiesSet() { |
97 | | - logger.info("Initialize devTopicArn = {}", devTopicArn); |
98 | | - logger.info("Initialize opsTopicArn = {}", opsTopicArn); |
| 96 | + log.info("Initialize devTopicArn = {}", devTopicArn); |
| 97 | + log.info("Initialize opsTopicArn = {}", opsTopicArn); |
99 | 98 | } |
100 | 99 |
|
101 | 100 | /** |
@@ -200,23 +199,23 @@ private void notifyMessage0(String topicArn, String originalSubject, String mess |
200 | 199 | String subject = String.format(Locale.ENGLISH, "[%s:%s] %s (%s)", |
201 | 200 | appCodeName, stackName, originalSubject, env.getActiveProfilesAsString()); |
202 | 201 | if (subject.length() > 100) { |
203 | | - logger.warn("Topic message subject is truncated. Full subject is: {}", subject); |
| 202 | + log.warn("Topic message subject is truncated. Full subject is: {}", subject); |
204 | 203 | subject = subject.substring(0, 100); |
205 | 204 | } |
206 | 205 |
|
207 | | - logger.debug("notify message to topic[{}] - {} : {}", topicArn, subject, message); |
| 206 | + log.debug("notify message to topic[{}] - {} : {}", topicArn, subject, message); |
208 | 207 | if (topicArn == null || topicArn.isEmpty() || topicArn.equals("arn:aws:sns:null")) { |
209 | | - logger.debug("topicArn: NULL"); |
| 208 | + log.debug("topicArn: NULL"); |
210 | 209 | return; |
211 | 210 | } |
212 | 211 | try { |
213 | 212 | sns.publish(new PublishRequest() |
214 | 213 | .withTopicArn(topicArn) |
215 | 214 | .withSubject(subject) |
216 | 215 | .withMessage(message)); |
217 | | - logger.debug("SNS Notification published: {} - {}", topicArn, subject); |
| 216 | + log.debug("SNS Notification published: {} - {}", topicArn, subject); |
218 | 217 | } catch (Exception e) { // NOPMD |
219 | | - logger.error("SNS Publish failed: {} - {} - {}", topicArn, subject, message, e); |
| 218 | + log.error("SNS Publish failed: {} - {} - {}", topicArn, subject, message, e); |
220 | 219 | } |
221 | 220 | } |
222 | 221 | } |
0 commit comments