logger - グローバル
ロガー API は、メールログにメッセージを追加する受信メールアクションを提供します。
情報、警告、およびエラーのメッセージを追加するメソッドを提供します。追加されるメッセージでは、送信元が email.<Sys ID of incoming email> に設定されます。
logger - log(文字列 msg)
指定されたメッセージをメールログに追加します。
| 名前 | タイプ | 説明 |
|---|---|---|
| msg | 文字列 | メールログに追加するテキスト。情報タイプのメッセージである必要があります。 |
| タイプ | 説明 |
|---|---|
| なし |
このコード例では、sys_user テーブルからメールを照会し、送信者情報に基づいて適切な logger メソッドを呼び出します。
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);
}
logger:logError(文字列 msg)
指定されたエラーメッセージをメールログファイルに追加します。
| 名前 | タイプ | 説明 |
|---|---|---|
| msg | 文字列 | メールログに追加するエラーメッセージ |
| タイプ | 説明 |
|---|---|
| なし |
このコード例では、sys_user テーブルからメールを照会し、送信者情報に基づいて適切な logger メソッドを呼び出します。
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);
}
logger:logWarning(文字列 msg)
指定された警告メッセージをメールログファイルに追加します。
| 名前 | タイプ | 説明 |
|---|---|---|
| msg | 文字列 | メールログに追加する警告メッセージ |
| タイプ | 説明 |
|---|---|
| なし |
このコード例では、sys_user テーブルからメールを照会し、送信者情報に基づいて適切な logger メソッドを呼び出します。
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);
}