aboutsummaryrefslogtreecommitdiff
path: root/paludis/environments/paludis/default_output.conf
blob: cdd80ae2642ea411f34d0e1d86f4908225c8344c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# vim: set tw=80 ft=conf et sw=4 sts=4 :

# This is the default output configuration. In general, we show output to stdout
# where possible, we keep logs of messages, we keep logs of output only if a
# failure occurs, and we show elog messages at the end if we're running in an
# environment that shows summaries.
#
# We use a few user-settable variables:
#
# always_keep_output_logs may be set to 'true' to always keep output logs, even
# if a build succeeds.
#
# quiet may be set to 'true' to show only messages, rather than all output, when
# carrying out an action.

# First, we define some basic rules. If we're running exclusively, use the
# 'exclusive' manager:
[rule default_exclusive]
type = *
output_exclusivity = exclusive
manager = exclusive

# If we're running with others, use the 'interleaved' manager:
[rule default_interleaved]
type = *
output_exclusivity = with_others
manager = interleaved

# And if we're running in the background, use the 'background' manager:
[rule default_background]
type = *
output_exclusivity = background
manager = background

# We want special handling for pretends. Logging them is generally a bad idea,
# since it often prevents running as a normal user, and it's a waste of space,
# so we go straight to 'standard'. This generally shouldn't be overridden.
[rule default_pretend]
type = package
action = pretend
output_exclusivity = exclusive
manager = standard

# For pretend-fetches, we don't want to display any output at all, except if
# something fails, so we go to 'standard_on_failure'. Again, this generally
# shouldn't be overridden:
[rule default_pretend_fetch]
type = package
action = fetch
ignore_unfetched = true
output_exclusivity = exclusive
manager = standard_on_failure

# For info, we just go straight to 'standard'.
[rule default_info]
type = package
action = info
output_exclusivity = exclusive
manager = standard

# Next, our output managers. The simplest goes straight to stdout / stderr:
[manager standard]
handler = standard

# For when we want to send output to stdout / stderr, but only if things failed:
[manager standard_on_failure]
handler = forward_at_finish
child = standard
if_success = false
if_failure = true

# For when we're running with other processes, we send output to stdout /
# stderr, but only when we're told to do so, to avoid mixing up outputs from
# different processes in a huge confusing mess:
[manager standard_interleaved]
handler = buffer
child = standard

# The 'log_output' manager forwards to 'log_output_keep_always', unless the user
# has set 'always_keep_output_logs' to 'true', in which case it goes to
# 'log_output_keep_failures'.
[manager log_output]
handler = conditional_alias
condition_variable = always_keep_output_logs
if_true = log_output_keep_always
if_false = log_output_keep_failures
if_unset = log_output_keep_failures

# Our output log goes to a file, which gets discarded if we succeed or if it's
# empty. The summary_output options are used to display a message showing the
# location of the log when our output manager is closed:
[manager log_output_keep_failures]
handler = file
filename = ${root}/var/log/paludis/%{time}-%{action}-%{full_name}.out
keep_on_empty = false
keep_on_success = false
summary_output_manager = format_messages_standard
summary_output_message = Output log: ${filename}

# A variant on log_output_keep_failures, that always keeps logs. Selected if
# 'always_keep_output_logs' is 'true'.
[manager log_output_keep_always]
handler = file
filename = ${root}/var/log/paludis/%{time}-%{action}-%{full_name}.out
keep_on_empty = false
keep_on_success = true
summary_output_manager = format_messages_standard
summary_output_message = Output log: ${filename}

# For messages from background and quiet processes, we format them, and then
# send them to standard output when we're told to do so:
[manager format_messages_interleaved]
handler = format_messages
format_debug =
format_info = "%{green}***%{normal} %{message}%{newline}"
format_warn = "%{yellow}***%{normal} %{message}%{newline}"
format_error = "%{red}***%{normal} %{message}%{newline}"
format_log = "%{blue}***%{normal} %{message}%{newline}"
child = standard_interleaved

# For messages from quiet exclusive processes, we format them, and send them to
# standard output immediately:
[manager format_messages_standard]
handler = format_messages
format_debug =
format_info = "%{green}***%{normal} %{message}%{newline}"
format_warn = "%{yellow}***%{normal} %{message}%{newline}"
format_error = "%{red}***%{normal} %{message}%{newline}"
format_log = "%{blue}***%{normal} %{message}%{newline}"
child = standard

# For messages going to logs, we format without colour:
[manager format_log_messages_always]
handler = format_messages
format_debug =
format_info = I %{message}%{newline}
format_warn = W %{message}%{newline}
format_error = E %{message}%{newline}
format_log = L %{message}%{newline}
child = log_messages_always

# Our messages log goes to a file, which gets discarded only if it is empty:
[manager log_messages_always]
handler = file
filename = ${root}/var/log/paludis/%{time}-%{action}-%{full_name}.messages
keep_on_empty = false
keep_on_success = true
summary_output_manager = format_messages_standard
summary_output_message = Messages log: ${filename}

# Our messages also get displayed at the end, but only for log messages, and
# only if our environment supports summaries:
[manager format_important_log_messages_at_end]
handler = conditional_alias
condition_variable = summaries_supported
if_true = format_important_log_messages_at_end_supported
if_false = null
if_unset = null

# format_important_log_messages_at_end has decided we support summaries, so show
# log messages at the end. we may or may not want to show info messages too.
[manager format_important_log_messages_at_end_supported]
handler = conditional_alias
condition_variable = info_messages_are_spam
if_true = format_important_log_messages_at_end_supported_without_info
if_false = format_important_log_messages_at_end_supported_with_info
if_unset = null

# format_important_log_messages_at_end, and einfo is not useless spam:
[manager format_important_log_messages_at_end_supported_with_info]
handler = format_messages
format_debug =
format_info = "%{green}***%{normal} %{message}%{newline}"
format_warn =
format_error =
format_log = "%{blue}***%{normal} %{message}%{newline}"
child = important_log_messages_at_end

# format_important_log_messages_at_end, and einfo is useless spam:
[manager format_important_log_messages_at_end_supported_without_info]
handler = format_messages
format_debug =
format_info =
format_warn =
format_error =
format_log = "%{blue}***%{normal} %{message}%{newline}"
child = important_log_messages_at_end

# At the end, we forward stored important log messages to standard output:
[manager important_log_messages_at_end]
handler = forward_at_finish
if_success = true
if_failure = false
child = standard

# Our handler for 'exclusive' forwards to either 'exclusive_default', or, if
# 'quiet' is set to 'true', 'exclusive_quiet'.
[manager exclusive]
handler = conditional_alias
condition_variable = quiet
if_true = exclusive_quiet
if_false = exclusive_default
if_unset = exclusive_default

# When we're running exclusively, send output to standard, keep an output log
# which, at user option, is deleted upon success, and keep a messages log:
[manager exclusive_default]
handler = tee
children = standard log_output
messages_children = format_log_messages_always format_important_log_messages_at_end

# Alternatively, only send messages to standard rather than full output:
[manager exclusive_quiet]
handler = tee
children = log_output
messages_children = format_log_messages_always format_messages_standard format_important_log_messages_at_end

# Our handler for 'interleaved' forwards to either 'interleaved_default' or, if
# 'quiet' is set to 'true', 'interleaved_quiet':
[manager interleaved]
handler = conditional_alias
condition_variable = quiet
if_true = interleaved_quiet
if_false = interleaved_default
if_unset = interleaved_default

# When we're running with other processes, send output to standard only when
# told to, keep an output which, at user option, is deleted upon success, and
# keep a messages log:
[manager interleaved_default]
handler = tee
children = standard_interleaved log_output
messages_children = format_log_messages_always format_important_log_messages_at_end

# Alternatively, only send messages to standard rather than full output:
[manager interleaved_quiet]
handler = tee
children = log_output
messages_children = format_log_messages_always format_messages_interleaved format_important_log_messages_at_end

# When we're running in the background, keep an output log which, at user
# option, is deleted upon success, always keep a messages log, and send messages
# to standard only when told to:
[manager background]
handler = tee
children = log_output
messages_children = format_log_messages_always format_messages_interleaved format_important_log_messages_at_end

# We need a way to discard messages
[manager null]
handler = tee
children =
messages_children =