class QB::IPC::STDIO::Server::Service
STDIO as a service exposed on a UNIX socket so that modules can stream their output to it, which is in turn printed to the console `qb` is running in.
Attributes
env_var_name[R]
TODO document `env_var_name` attribute.
@return [String]
name[R]
The service's name, like `:in`, `:out`, `:err`.
@return [Synbol]
path[R]
Absolute path to socket file.
@return [Pathname]
server[R]
The UNIX socket server.
@return [UNIXServer?]
socket[R]
The socket we accept from the server.
@return [UNIXSocket]
thread[R]
TODO document `thread` attribute.
@return [attr_type]
Public Class Methods
new(name:, socket_dir: @name = name)
click to toggle source
Construct an IO service.
@param [Symbol] name
What this service is for... `:in`, `:out`, `:err`... Used as the thread name.
# File lib/qb/ipc/stdio/server/service.rb, line 93 def initialize name:, socket_dir: @name = name @thread = nil @server = nil @socket = nil @env_var_name = QB::IPC::STDIO.path_env_var_name name @path = socket_dir.join "#{ name }.sock" self.logger = create_logger logger.debug "Initialized" end
Protected Instance Methods
create_logger()
click to toggle source
Initialize the {#logger}.
@protected @return [nil]
# File lib/qb/ipc/stdio/server/service.rb, line 116 def create_logger logger = NRSER::Log[ self ] # HACK # # Tracing the IO is *really* noisy and spaghettis up the log output # due to the threaded nature of the this beast... which is what you # *want* if you're debugging main/module process IO, since it shows # you what's happening synchronously, but that's pretty much all you # can debug when it's being output. # # The `debug`-level output is # # For that reason, I quickly threw # if ENV['QB_TRACE_STDIO'].truthy? logger.level = :trace elsif ENV['QB_DEBUG_STDIO'].truthy? logger.level = :debug else logger.level = :info end logger end