| 1 | BEGIN { |
| 2 | OFS = Msg_fs ? Msg_fs : "|" |
| 3 | Kfs = Key_fs ? Key_fs : ":" |
| 4 | } |
| 5 | |
| 6 | function msg_out_ok_alert(priority, subject, body, key, val) { |
| 7 | # priority : "low" | "med" | "hi" |
| 8 | # subject : string without spaces |
| 9 | # body : anything |
| 10 | key = "alert" Kfs priority Kfs subject |
| 11 | val = body |
| 12 | msg_out_ok(key, val) |
| 13 | } |
| 14 | |
| 15 | function msg_out_ok(key, val) { |
| 16 | msg_out("OK", key, val, "/dev/stdout") |
| 17 | } |
| 18 | |
| 19 | function msg_out_info(location, msg) { |
| 20 | msg_out("INFO", location, msg, "/dev/stderr") |
| 21 | } |
| 22 | |
| 23 | function msg_out_error(location, msg) { |
| 24 | msg_out("ERROR", location, msg, "/dev/stderr") |
| 25 | } |
| 26 | |
| 27 | function msg_out(status, key, val, channel) { |
| 28 | print(status, Module, key, val) > channel |
| 29 | } |