Class: ATNA::Logger
- Inherits:
-
Object
- Object
- ATNA::Logger
- Defined in:
- lib/atna/logger.rb
Constant Summary collapse
- VALID_OPTIONS =
ATNA メッセージ構築用パラメータ
[:pri, :version, :timestamp, :hostname, :app_name, :procid, :msgid, :structured_data]
- UTF8_BOMB =
ATNA 用の UTF-8 BOMB
0xEFBBBF
- PRI =
PRI の値
"<85>"- MSGID =
MSGID の値(ATNA では固定値)
"IHE+RFC-3881"
Instance Method Summary collapse
-
#initialize(host = 'localhost', port = 514, default_options = { }) ⇒ Logger
constructor
A new instance of Logger.
-
#notify!(xmlmsg, options = { }) ⇒ Object
メッセージを送信.
Constructor Details
#initialize(host = 'localhost', port = 514, default_options = { }) ⇒ Logger
Returns a new instance of Logger.
19 20 21 22 |
# File 'lib/atna/logger.rb', line 19 def initialize(host = 'localhost', port = 514, = { }) @host, @port = host, port = end |
Instance Method Details
#notify!(xmlmsg, options = { }) ⇒ Object
メッセージを送信
- xmlmsg
-
送信すべき XML メッセージ本体
- options
- :version
-
バージョン番号
- :timestamp
-
Time インスタンス(未指定時は現在時刻を利用)
- :hostname
-
メッセージ発信元 hostname(未指定時はホスト名を取得:localhost時は - を設定)
- :app_name
-
アプリケーション名(未指定時は - を設定)
- :procid
-
プロセスID(未指定時は - を設定)
- :msgid
-
メッセージID(未指定時は - を設定)
- :structured_data
-
構造化データ
35 36 37 38 39 40 41 42 43 |
# File 'lib/atna/logger.rb', line 35 def notify!(xmlmsg, = { }) = .merge() () () sender = UdpSender.new(@host, @port) datagram = (xmlmsg, ) sender.send(datagram) end |