Skip to content

Commit 770029f

Browse files
authored
Merge pull request #1638 from toggetit/master
Fix logging statements in locations
2 parents 564577e + 7fde9ea commit 770029f

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

spec/defines/resource_location_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@
295295
title: 'should set error_log',
296296
attr: 'error_log',
297297
value: '/path/to/error.log',
298-
match: ' error_log /path/to/error.log;'
298+
match: ' error_log /path/to/error.log;'
299299
},
300300
{
301301
title: 'should allow multiple error_log directives',
302302
attr: 'error_log',
303303
value: ['/path/to/error.log', 'syslog:server=localhost'],
304304
match: [
305-
' error_log /path/to/error.log;',
306-
' error_log syslog:server=localhost;'
305+
' error_log /path/to/error.log;',
306+
' error_log syslog:server=localhost;'
307307
]
308308
},
309309
{

templates/server/location_header.erb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,20 @@
9191
<% if @access_log -%>
9292
<% if @access_log.is_a?(Array) -%>
9393
<%- @access_log.each do |log_item| -%>
94-
access_log <%= log_item %><% unless @format_log.nil? -%> <%= @format_log %><% end -%>;
94+
access_log <%= log_item %><% unless @format_log.nil? -%> <%= @format_log %><% end -%>;
9595
<%- end -%>
9696
<% elsif @access_log == 'absent' -%>
9797
<% elsif @access_log == 'off' -%>
98-
access_log off;
98+
access_log off;
9999
<% else -%>
100100
access_log <%= @access_log %><% unless @format_log.nil? -%> <%= @format_log %><% end -%>;
101101
<% end -%>
102102
<% end -%>
103103
<% if @error_log.is_a?(Array) -%>
104104
<%- @error_log.each do |log_item| -%>
105-
error_log <%= log_item %>;
105+
error_log <%= log_item %>;
106106
<%- end -%>
107-
<% elsif @error_log == 'absent' -%>
108-
<% elsif not @error_log -%>
109-
error_log <%= scope['::nginx::config::log_dir'] %>/<%= @name_sanitized %>.error.log;
107+
<% elsif @error_log == 'absent' || @error_log.nil? -%>
110108
<% else -%>
111-
error_log <%= @error_log %>;
109+
error_log <%= @error_log %>;
112110
<% end -%>

0 commit comments

Comments
 (0)