# File lib/orocos/roby/app.rb, line 129 def main_group log_groups[nil] end
Orocos engine configuration interface
The main instance of this object can be accessed as Roby::Conf.orocos. For instance,
Roby::Conf.orocos.disable_logging
will completely disable logging (not recommended !)
The set of currently defined log groups
It is a mapping from the log group name to the corresponding LogGroup instance
# File lib/orocos/roby/app.rb, line 102 def initialize super @log_enabled = true @conf_log_enabled = true @redirect_local_process_server = true @log_groups = { nil => LogGroup.new(false) } registry = Typelib::Registry.new Typelib::Registry.add_standard_cxx_types(registry) registry.each do |t| if t < Typelib::NumericType main_group.names << t.name end end end
Returns true if deployment is completely excluded from logging
# File lib/orocos/roby/app.rb, line 201 def deployment_excluded_from_log?(deployment) if !log_enabled? true else matches = log_groups.find_all { |_, group| group.matches_deployment?(deployment) } !matches.empty? && matches.all? { |_, group| !group.enabled? } end end
See #conf_log_enabled?
# File lib/orocos/roby/app.rb, line 198 def disable_conf_logging; @conf_log_enabled = false end
# File lib/orocos/roby/app.rb, line 168 def disable_log_group(name) name = name.to_s if !log_groups.has_key?(name) raise ArgumentError, "no such log group #{name}. Available groups are: #{log_groups.keys.join(", ")}" end log_groups[name].enabled = false end
See #log_enabled?
# File lib/orocos/roby/app.rb, line 188 def disable_logging; @log_enabled = false end
See #conf_log_enabled?
# File lib/orocos/roby/app.rb, line 196 def enable_conf_logging; @conf_log_enabled = true end
# File lib/orocos/roby/app.rb, line 160 def enable_log_group(name) name = name.to_s if !log_groups.has_key?(name) raise ArgumentError, "no such log group #{name}. Available groups are: #{log_groups.keys.join(", ")}" end log_groups[name].enabled = true end
See #log_enabled?
# File lib/orocos/roby/app.rb, line 186 def enable_logging; @log_enabled = true end
Exclude object from the logging system
object can be
a deployment model, in which case no task in this deployment will be logged
a task model, in which case no port of any task of this type will be logged
a port model, in which case no such port will be logged (regardless of which task it is on)
a string. It can then either be a task name, a port name or a type name
# File lib/orocos/roby/app.rb, line 156 def exclude_from_log(object, subname = nil) main_group.add(object, subname) end
Create a new log group with the given name
A log groups are sets of filters that are used to match deployments, tasks or specific ports. These filters can be enabled or disabled using their name with #enable_log_group and #disable_log_group
# File lib/orocos/roby/app.rb, line 139 def log_group(name, &block) group = LogGroup.new group.load(&block) log_groups[name.to_str] = group end
The main log filter
See #log_group
# File lib/orocos/roby/app.rb, line 129 def main_group log_groups[nil] end
Returns true if the port with name port_name of task model
task_model in deployment deployment should be
logged or not
# File lib/orocos/roby/app.rb, line 212 def port_excluded_from_log?(deployment, task_model, port) if !log_enabled? true else matches = log_groups.find_all { |_, group| group.matches_port?(deployment, task_mode, port) } !matches.empty? && matches.all? { |_, group| !group.enabled? } end end