로거 - 전역
로거 API는 이메일 로그에 메시지를 추가하는 인바운드 이메일 작업을 제공합니다.
정보, 경고 및 오류 메시지를 추가하는 메서드를 제공합니다. 추가된 메시지의 소스가 email.<수신 이메일의 시스템 ID>로 설정되어 있습니다.
로거 - 로그(문자열 메시지)
지정된 메시지를 이메일 로그에 추가합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| msg | 문자열 | 이메일 로그에 추가할 텍스트입니다. 정보 유형 메시지여야 합니다. |
| 유형 | 설명 |
|---|---|
| void |
이 코드 예제에서는 sys_user 테이블에서 전자 메일을 쿼리한 다음 보낸 사람 정보에 따라 적절한 로거 메서드를 호출합니다.
var grUser = new GlideRecord("sys_user");
grUser.addQuery("email", email.from);
grUser.query();
if (grUser.next()) {
if (grUser.user_name) {
logger.log("Sender found: " + email.from); //Append information message to the email log
createInc(grUser.sys_id);
} else {
logger.logWarning("Sender: " + email.from + " " + "found but no userID found, please take necessary actions"); //Append warning message to the email log.
createInc(grUser.sys_id);
}
} else {
logger.logError("Sender is not present in the system hence action aborted"); //Append error message to the email log.
current.setAbortAction(true);
}
로거 - logError(String msg)
지정된 오류 메시지를 이메일 로그 파일에 추가합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| msg | 문자열 | 이메일 로그에 추가할 오류 메시지 |
| 유형 | 설명 |
|---|---|
| void |
이 코드 예제에서는 sys_user 테이블에서 전자 메일을 쿼리한 다음 보낸 사람 정보에 따라 적절한 로거 메서드를 호출합니다.
var grUser = new GlideRecord("sys_user");
grUser.addQuery("email", email.from);
grUser.query();
if (grUser.next()) {
if (grUser.user_name) {
logger.log("Sender found: " + email.from); //Append information message to the email log
createInc(grUser.sys_id);
} else {
logger.logWarning("Sender: " + email.from + " " + "found but no userID found, please take necessary actions"); //Append warning message to the email log.
createInc(grUser.sys_id);
}
} else {
logger.logError("Sender is not present in the system hence action aborted"); //Append error message to the email log.
current.setAbortAction(true);
}
로거 - logWarning(String msg)
지정된 경고 메시지를 이메일 로그 파일에 추가합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| msg | 문자열 | 이메일 로그에 추가할 경고 메시지 |
| 유형 | 설명 |
|---|---|
| void |
이 코드 예제에서는 sys_user 테이블에서 전자 메일을 쿼리한 다음 보낸 사람 정보에 따라 적절한 로거 메서드를 호출합니다.
var grUser = new GlideRecord("sys_user");
grUser.addQuery("email", email.from);
grUser.query();
if (grUser.next()) {
if (grUser.user_name) {
logger.log("Sender found: " + email.from); //Append information message to the email log
createInc(grUser.sys_id);
} else {
logger.logWarning("Sender: " + email.from + " " + "found but no userID found, please take necessary actions"); //Append warning message to the email log.
createInc(grUser.sys_id);
}
} else {
logger.logError("Sender is not present in the system hence action aborted"); //Append error message to the email log.
current.setAbortAction(true);
}