diff options
| author | Antonin Godard <antonin.godard@bootlin.com> | 2025-04-18 17:15:26 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-04-24 11:53:00 +0100 |
| commit | 1215042fa7a67f538d379cabaa0e1ba25c593b9b (patch) | |
| tree | 722be95c8e8a0aa607ea0584a4306a0362314d25 /bitbake/lib | |
| parent | 8c24921ba61b05b903e3b94ecdb131f5a9dbe247 (diff) | |
| download | poky-1215042fa7a67f538d379cabaa0e1ba25c593b9b.tar.gz | |
bitbake: lib/bb: format and improve logging docstrings
Format the docstrings of the utils modules to be automatically
documented with the autodoc Sphinx extensions.
(Bitbake rev: 4963bfc6045ad1f49e721edd97766dab1e2d1edc)
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/__init__.py | 76 |
1 files changed, 70 insertions, 6 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index 5668355737..c95c91a4cb 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py | |||
| @@ -129,9 +129,25 @@ sys.modules['bb.fetch'] = sys.modules['bb.fetch2'] | |||
| 129 | 129 | ||
| 130 | # Messaging convenience functions | 130 | # Messaging convenience functions |
| 131 | def plain(*args): | 131 | def plain(*args): |
| 132 | """ | ||
| 133 | Prints a message at "plain" level (higher level than a ``bb.note()``). | ||
| 134 | |||
| 135 | Arguments: | ||
| 136 | |||
| 137 | - ``args``: one or more strings to print. | ||
| 138 | """ | ||
| 132 | mainlogger.plain(''.join(args)) | 139 | mainlogger.plain(''.join(args)) |
| 133 | 140 | ||
| 134 | def debug(lvl, *args): | 141 | def debug(lvl, *args): |
| 142 | """ | ||
| 143 | Prints a debug message. | ||
| 144 | |||
| 145 | Arguments: | ||
| 146 | |||
| 147 | - ``lvl``: debug level. Higher value increases the debug level | ||
| 148 | (determined by ``bitbake -D``). | ||
| 149 | - ``args``: one or more strings to print. | ||
| 150 | """ | ||
| 135 | if isinstance(lvl, str): | 151 | if isinstance(lvl, str): |
| 136 | mainlogger.warning("Passed invalid debug level '%s' to bb.debug", lvl) | 152 | mainlogger.warning("Passed invalid debug level '%s' to bb.debug", lvl) |
| 137 | args = (lvl,) + args | 153 | args = (lvl,) + args |
| @@ -139,33 +155,81 @@ def debug(lvl, *args): | |||
| 139 | mainlogger.bbdebug(lvl, ''.join(args)) | 155 | mainlogger.bbdebug(lvl, ''.join(args)) |
| 140 | 156 | ||
| 141 | def note(*args): | 157 | def note(*args): |
| 158 | """ | ||
| 159 | Prints a message at "note" level. | ||
| 160 | |||
| 161 | Arguments: | ||
| 162 | |||
| 163 | - ``args``: one or more strings to print. | ||
| 164 | """ | ||
| 142 | mainlogger.info(''.join(args)) | 165 | mainlogger.info(''.join(args)) |
| 143 | 166 | ||
| 144 | # | ||
| 145 | # A higher prioity note which will show on the console but isn't a warning | ||
| 146 | # | ||
| 147 | # Something is happening the user should be aware of but they probably did | ||
| 148 | # something to make it happen | ||
| 149 | # | ||
| 150 | def verbnote(*args): | 167 | def verbnote(*args): |
| 168 | """ | ||
| 169 | A higher priority note which will show on the console but isn't a warning. | ||
| 170 | |||
| 171 | Use in contexts when something is happening the user should be aware of but | ||
| 172 | they probably did something to make it happen. | ||
| 173 | |||
| 174 | Arguments: | ||
| 175 | |||
| 176 | - ``args``: one or more strings to print. | ||
| 177 | """ | ||
| 151 | mainlogger.verbnote(''.join(args)) | 178 | mainlogger.verbnote(''.join(args)) |
| 152 | 179 | ||
| 153 | # | 180 | # |
| 154 | # Warnings - things the user likely needs to pay attention to and fix | 181 | # Warnings - things the user likely needs to pay attention to and fix |
| 155 | # | 182 | # |
| 156 | def warn(*args): | 183 | def warn(*args): |
| 184 | """ | ||
| 185 | Prints a warning message. | ||
| 186 | |||
| 187 | Arguments: | ||
| 188 | |||
| 189 | - ``args``: one or more strings to print. | ||
| 190 | """ | ||
| 157 | mainlogger.warning(''.join(args)) | 191 | mainlogger.warning(''.join(args)) |
| 158 | 192 | ||
| 159 | def warnonce(*args): | 193 | def warnonce(*args): |
| 194 | """ | ||
| 195 | Prints a warning message like ``bb.warn()``, but only prints the message | ||
| 196 | once. | ||
| 197 | |||
| 198 | Arguments: | ||
| 199 | |||
| 200 | - ``args``: one or more strings to print. | ||
| 201 | """ | ||
| 160 | mainlogger.warnonce(''.join(args)) | 202 | mainlogger.warnonce(''.join(args)) |
| 161 | 203 | ||
| 162 | def error(*args, **kwargs): | 204 | def error(*args, **kwargs): |
| 205 | """ | ||
| 206 | Prints an error message. | ||
| 207 | |||
| 208 | Arguments: | ||
| 209 | |||
| 210 | - ``args``: one or more strings to print. | ||
| 211 | """ | ||
| 163 | mainlogger.error(''.join(args), extra=kwargs) | 212 | mainlogger.error(''.join(args), extra=kwargs) |
| 164 | 213 | ||
| 165 | def erroronce(*args): | 214 | def erroronce(*args): |
| 215 | """ | ||
| 216 | Prints an error message like ``bb.error()``, but only prints the message | ||
| 217 | once. | ||
| 218 | |||
| 219 | Arguments: | ||
| 220 | |||
| 221 | - ``args``: one or more strings to print. | ||
| 222 | """ | ||
| 166 | mainlogger.erroronce(''.join(args)) | 223 | mainlogger.erroronce(''.join(args)) |
| 167 | 224 | ||
| 168 | def fatal(*args, **kwargs): | 225 | def fatal(*args, **kwargs): |
| 226 | """ | ||
| 227 | Prints an error message and stops the BitBake execution. | ||
| 228 | |||
| 229 | Arguments: | ||
| 230 | |||
| 231 | - ``args``: one or more strings to print. | ||
| 232 | """ | ||
| 169 | mainlogger.critical(''.join(args), extra=kwargs) | 233 | mainlogger.critical(''.join(args), extra=kwargs) |
| 170 | raise BBHandledException() | 234 | raise BBHandledException() |
| 171 | 235 | ||
