Class: Baykit::BayServer::Docker::BuiltIn::LogBoat

Inherits:
WaterCraft::Boat show all
Includes:
Agent::Transporter::DataListener, Protocol
Defined in:
lib/baykit/bayserver/docker/built_in/log_boat.rb

Defined Under Namespace

Classes: LogPacket

Constant Summary

Constants inherited from WaterCraft::Boat

WaterCraft::Boat::BOAT_ID_NOCHECK, WaterCraft::Boat::INVALID_BOAT_ID

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Agent::Transporter::DataListener

#check_timeout, #notify_connect, #notify_eof, #notify_handshake_done, #notify_protocol_error, #notify_read

Methods inherited from WaterCraft::Boat

#check_timeout, #init_boat

Constructor Details

#initializeLogBoat



23
24
25
# File 'lib/baykit/bayserver/docker/built_in/log_boat.rb', line 23

def initialize()
  super
end

Instance Attribute Details

#file_nameObject (readonly)

Returns the value of attribute file_name.



20
21
22
# File 'lib/baykit/bayserver/docker/built_in/log_boat.rb', line 20

def file_name
  @file_name
end

#postmanObject (readonly)

Returns the value of attribute postman.



21
22
23
# File 'lib/baykit/bayserver/docker/built_in/log_boat.rb', line 21

def postman
  @postman
end

Instance Method Details

#init(file_name, postman) ⇒ Object

Custom methods



52
53
54
55
56
# File 'lib/baykit/bayserver/docker/built_in/log_boat.rb', line 52

def init(file_name, postman)
  init_boat()
  @file_name = file_name
  @postman = postman
end

#log(data) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/baykit/bayserver/docker/built_in/log_boat.rb', line 58

def log(data)
  if data == nil
    data = ""
  end
  data += CharUtil::LF

  @postman.post(data, nil, file_name)
end

#notify_closeObject

Implements DataListener



44
45
46
# File 'lib/baykit/bayserver/docker/built_in/log_boat.rb', line 44

def notify_close()
  BayLog.info("Log closed: %s", self.file_name)
end

#resetObject

Implements Reusable



35
36
37
38
# File 'lib/baykit/bayserver/docker/built_in/log_boat.rb', line 35

def reset()
  @file_name = nil
  @postman = nil
end

#to_sObject



27
28
29
# File 'lib/baykit/bayserver/docker/built_in/log_boat.rb', line 27

def to_s()
  return "lboat##{@boart_id}/#{@object_id} file=#{@file_name}";
end