Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Enable configuring dispatch router logging
  • Loading branch information
stbenjam committed Nov 4, 2015
1 parent 37a59c6 commit abbcafc
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
30 changes: 30 additions & 0 deletions manifests/router/log.pp
@@ -0,0 +1,30 @@
# == Define: qpid::router::log
#
# Configure qpid router logging
#
# == Parameters
#
# $module:: Logging module to use
#
# $level:: Logging level to use (e.g., debug+, info+)
#
# $timestamp:: Enable timestamps
# type:boolean
#
# $output:: Log file location
#
define qpid::router::log(
$module = 'DEFAULT',
$level = 'info+',
$timestamp = true,
$output = '/var/log/qdrouterd.log',
){

validate_bool($timestamp)
validate_absolute_path($output)

concat_fragment {"qdrouter+log_${title}.conf":
content => template('qpid/router/log.conf.erb'),
}

}
26 changes: 26 additions & 0 deletions spec/classes/qpid_router_config_spec.rb
Expand Up @@ -210,5 +210,31 @@
]
end
end

context 'with logging' do
let :pre_condition do
'class {"qpid::router":}
qpid::router::log { "logging":
module => "DEFAULT",
level => "debug+",
timestamp => false,
output => "/var/log/qpid.log",
}
'
end

it 'should have log fragment' do
content = catalogue.resource('concat_fragment', 'qdrouter+log_logging.conf').send(:parameters)[:content]
content.split("\n").reject { |c| c =~ /(^#|^$)/ }.should == [
'log {',
' module: DEFAULT',
' enabled: debug+',
' timestamp: false',
' output: /var/log/qpid.log',
'}'
]
end
end
end
end
6 changes: 6 additions & 0 deletions templates/router/log.conf.erb
@@ -0,0 +1,6 @@
log {
module: <%= @module %>
enabled: <%= @level %>
timestamp: <%= @timestamp %>
output: <%= @output %>
}

0 comments on commit abbcafc

Please sign in to comment.