Commit fd07336211c3b3088dce20b1c22a99e6303c68c2
1 parent
f49462e547
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
patman: Update tout to avoid open-coding the debug levels
Use the debug level constants instead of open-coding them in the file. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 1 changed file with 7 additions and 11 deletions Side-by-side Diff
tools/patman/tout.py
... | ... | @@ -11,11 +11,7 @@ |
11 | 11 | import terminal |
12 | 12 | |
13 | 13 | # Output verbosity levels that we support |
14 | -ERROR = 0 | |
15 | -WARNING = 1 | |
16 | -NOTICE = 2 | |
17 | -INFO = 3 | |
18 | -DEBUG = 4 | |
14 | +ERROR, WARNING, NOTICE, INFO, DETAIL, DEBUG = range(6) | |
19 | 15 | |
20 | 16 | in_progress = False |
21 | 17 | |
... | ... | @@ -107,7 +103,7 @@ |
107 | 103 | Args: |
108 | 104 | msg; Message to display. |
109 | 105 | """ |
110 | - _Output(0, msg, _color.RED) | |
106 | + _Output(ERROR, msg, _color.RED) | |
111 | 107 | |
112 | 108 | def Warning(msg): |
113 | 109 | """Display a warning message |
... | ... | @@ -115,7 +111,7 @@ |
115 | 111 | Args: |
116 | 112 | msg; Message to display. |
117 | 113 | """ |
118 | - _Output(1, msg, _color.YELLOW) | |
114 | + _Output(WARNING, msg, _color.YELLOW) | |
119 | 115 | |
120 | 116 | def Notice(msg): |
121 | 117 | """Display an important infomation message |
... | ... | @@ -123,7 +119,7 @@ |
123 | 119 | Args: |
124 | 120 | msg; Message to display. |
125 | 121 | """ |
126 | - _Output(2, msg) | |
122 | + _Output(NOTICE, msg) | |
127 | 123 | |
128 | 124 | def Info(msg): |
129 | 125 | """Display an infomation message |
... | ... | @@ -131,7 +127,7 @@ |
131 | 127 | Args: |
132 | 128 | msg; Message to display. |
133 | 129 | """ |
134 | - _Output(3, msg) | |
130 | + _Output(INFO, msg) | |
135 | 131 | |
136 | 132 | def Detail(msg): |
137 | 133 | """Display a detailed message |
... | ... | @@ -139,7 +135,7 @@ |
139 | 135 | Args: |
140 | 136 | msg; Message to display. |
141 | 137 | """ |
142 | - _Output(4, msg) | |
138 | + _Output(DETAIL, msg) | |
143 | 139 | |
144 | 140 | def Debug(msg): |
145 | 141 | """Display a debug message |
... | ... | @@ -147,7 +143,7 @@ |
147 | 143 | Args: |
148 | 144 | msg; Message to display. |
149 | 145 | """ |
150 | - _Output(5, msg) | |
146 | + _Output(DEBUG, msg) | |
151 | 147 | |
152 | 148 | def UserOutput(msg): |
153 | 149 | """Display a message regardless of the current output level. |