osbrain.logging
— osBrain logging logic¶
Implementation of logging-related features.
-
class
osbrain.logging.
Logger
(name=None, host=None, serializer=None, transport=None)¶ Bases:
osbrain.agent.Agent
Specialized Agent for logging. Binds a SUB socket and starts logging incoming messages.
Methods
addr
(alias)Parameters: after
(delay, method, *args[, alias])Execute an action after a delay. bind
(kind[, alias, handler, addr, …])Bind to an agent address. close_sockets
()Close all non-internal zmq sockets. connect
(server[, alias, handler])Connect to a server agent address. each
(period, method, *args[, alias])Execute a repeated action with a defined period. execute_function
(function, *args, **kwargs)Execute a function passed as parameter. get_unique_external_zmq_sockets
()Return an iterable containing all the zmq.Socket objects from self.socket which are not internal, without repetition. iddle
()This function is to be executed when the agent is iddle. iterate
()Agent’s main iteration. list_timers
()Returns: log_debug
(message[, logger])Log a debug message. log_error
(message[, logger])Log an error message. log_handler
(message, topic)Handle incoming log messages. log_info
(message[, logger])Log an info message. log_warning
(message[, logger])Log a warning message. loop
()Agent’s main loop. on_init
()This user-defined method is to be executed after initialization. ping
()A test method to check the readiness of the agent. raise_exception
()Raise an exception (for testing purposes). recv
(address)Receive a message from the specified address. run
()Run the agent. safe_call
(method, *args, **kwargs)A safe call to a method. send
(address, message[, topic, handler, …])Send a message through the specified address. send_recv
(address, message)This method is only used in REQREP communication patterns. set_attr
(**kwargs)Set object attributes. set_logger
(logger[, alias])Connect the agent to a logger and start logging messages to it. set_method
(*args, **kwargs)Set object methods. stop
()Stop the agent. stop_all_timers
()Stop all currently running timers. stop_timer
(alias)Stop a currently running timer. subscribe
(alias, handlers, str], Any])Subscribe the agent to another agent. get_attr kill register registered shutdown -
log_handler
(message, topic)¶ Handle incoming log messages.
-
on_init
()¶ This user-defined method is to be executed after initialization.
-
-
osbrain.logging.
pyro_log
()¶ Set environment variables to activate Pyro logging. The log level is set to “DEBUG”.
-
osbrain.logging.
run_logger
(name, nsaddr=None, addr=None, base=<class 'osbrain.logging.Logger'>)¶ Ease the logger creation process.
This function will create a new logger, start the process and then run its main loop through a proxy.
Parameters: - name : str
Logger name or alias.
- nsaddr : SocketAddress, default is None
Name server address.
- addr : SocketAddress, default is None
New logger address, if it is to be fixed.
Returns: - proxy
A proxy to the new logger.