Skip to content

Commit

Permalink
added RuntimeLogService
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Jan 21, 2015
1 parent e896c60 commit c870b34
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.skiwi.githubhooksechatservice.mvc.configuration.BotConfiguration;
import com.skiwi.githubhooksechatservice.mvc.controllers.WebhookParameters;
import com.skiwi.githubhooksechatservice.service.ConfigService;
import com.skiwi.githubhooksechatservice.service.RuntimeLogService;

/**
*
Expand All @@ -59,6 +60,9 @@ public class StackExchangeChatBot implements ChatBot, DisposableBean {
@Autowired
private ConfigService configService;

@Autowired
private RuntimeLogService logService;

private String chatFKey;

private String undeployGoodbyeText;
Expand Down Expand Up @@ -119,6 +123,9 @@ public void start() {
params.setPost(true);
postMessage(params, deployGreeting);
}
else {
logService.log("deploy", "No valid room: " + greetingRoom);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.skiwi.githubhooksechatservice.service;

public interface RuntimeLogService {

void log(String tag, String message);
void log(String message);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.skiwi.githubhooksechatservice.service;

import java.util.logging.Logger;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class RuntimeLogServiceImpl implements RuntimeLogService {

private final static Logger logger = Logger.getLogger(RuntimeLogServiceImpl.class.getSimpleName());

// TODO: Make it possible to read the messages at runtime

@Override
public void log(String tag, String message) {
logger.info(tag + ": " + message);
}

@Override
public void log(String message) {
log("no-tag", message);
}

}

0 comments on commit c870b34

Please sign in to comment.