summaryrefslogtreecommitdiffstats
path: root/lib/bb/msg.py
AgeCommit message (Collapse)Author
2020-03-12knotty/msg: Use logging.shutdown() instead of bb.msg.cleanupLogging()Joshua Watt
The logging module provides a shutdown() function that does the same thing in a much better way Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12msg: Return config objectJoshua Watt
Returns the configuration object from setLoggingConfig(). This object has a config dictionary that contains all of the created handlers, filters and loggers, which makes it much easier to pull out items with specific names. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12msg: Add helper to merge logging configsJoshua Watt
Adds a function that can be used by UI front ends to merge logging configuration fragments. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12knotty: Add logging cleanupJoshua Watt
Adds code to close all loggers when bitbake exits. This prevents unclosed file ResourceWarnings. A form of this closing existed previously, but was removed in the new logging code. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12lib/bb/msg: Add helper to set logging configJoshua Watt
Adds a helper function to setup the structure logging information in bitbake. The helper function takes a default configuration and an optional path to a user config file that can be merged into the default. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12lib/bb/msg: Remove unused filtersJoshua Watt
Now that the filter are described using the python logging structure, these classes are no longer needed. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12lib/bb/msg: Add filter utilitiesJoshua Watt
Adds generic filter utilities that can be used to filter when the log level is greater than or equal to a defined value, or below a defined value, as well as a generic function to translate a string to a logging level (or bitbake logging level) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12lib/bb/msg: Add repr for BBLogFormatterJoshua Watt
Adds a __repr__ function for BBLogFormatter. This allows it to get a human readable string when printed using the logging_tree module Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12lib/bb/msg: Use log level instead of debug countJoshua Watt
Passes around the actual logging level as the default log level variable instead of the debug count. This makes it easier to deal with logging levels since the conversion from debug count and verbose flag only has to occur once when logging is initialized and after that actual log levels can be used Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12lib/bb/msg: Convert default domains to a dictionaryJoshua Watt
Converts the default domain variable to a dictionary where the keys are the logging domains and the values are the logging level (instead of the debug count). This makes it easier to deal with the logging domains and the awkward conversion from a list to a dictionary only needs to be done once when logging is initialized. Finally, other code has been written that already assumes this variable is a dictionary, see: f04cd93109 ("bitbake: lib/bb: Optimise out debug messages from cooker") Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-19lib: remove unused importsFrazer Clews
removed unused imports which made the code harder to read, and slightly but less efficient Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Strip old editor directives from file headersRichard Purdie
There are much better ways to handle this and most editors shouldn't need this in modern times, drop the noise from the files. Its not consitently applied anyway. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Drop duplicate license boilerplace textRichard Purdie
With the introduction of SPDX-License-Identifier headers, we don't need a ton of header boilerplate in every file. Simplify the files and rely on the top level for the full licence text. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Add initial pass of SPDX license headers to source codeRichard Purdie
This adds the SPDX-License-Identifier license headers to the majority of our source files to make it clearer exactly which license files are under. The bulk of the files are under GPL v2.0 with one found to be under V2.0 or later, some under MIT and some have dual license. There are some files which are potentially harder to classify where we've imported upstream code and those can be handled specifically in later commits. The COPYING file is replaced with LICENSE.X files which contain the full license texts. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-07msg: Add explicit verbnote log levelRichard Purdie
It has become apparant we need a log level which reaches the console but isn't a warning/error. Add "verbnote" as a way of doing this, behaves as a note but with a higher priority. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-09knotty: prevent extra logger from being enabled for tinfoilPaul Eggleton
tinfoil sets up its own logger by default, but if and when we initialise the UI (by default knotty) will also set one up, leading to duplicated messages specifically from tasks. To avoid this, rather than adding some kind of parameter, just check if there is already a logger outputting to stdout/stderr and if so, skip adding our own. Part of the fix for [YOCTO #11275]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-27lib/bb/msg: introduce logger_create() functionPaul Eggleton
We use this code to set up a logger with colour in a number of different places, so create one function that does this and make some of bitbake's utility scripts use it. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-05knotty: add quiet output modePaul Eggleton
Quiet output mode disables printing most messages (below warnings) to the console; however these messages still go to the console log file. This is primarily for cases where bitbake is being launched interactively from some other process, but where full console output is not needed. Because of the need to keep logging all normal events to the console log, this functionality was implemented within the knotty UI rather than in bb.msg (where verbose mode is implemented). We don't currently have a means of registering command line options from the UI end, thus the option actually has to be registered in main.py regardless of the UI, however I didn't feel like it was worth setting up such a mechanism just for this option. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-01bitbake: Convert to python 3Richard Purdie
Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-12event/msg: Pass formatted exceptionsRichard Purdie
python3 can't cope with the previous approach we were using to pass exceptions through the RPC. Avoid this by creating a formatted exception on the sender side. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-17Fix default function parameter assignment to a listPaul Eggleton
With python you should not assign a list as the default value of a function parameter - because a list is mutable, the result will be that the first time a value is passed it will actually modify the default. Reference: http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-27msg: Add stdout/stderr filtersRichard Purdie
Add logging filters which can be used to split output between stdout and stderr, ERROR messages and above as passed by the Err filter, anything below ERROR is passed by the Out filter. This is useful when trying to make stderr more useful. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-23event/msg: Add primitive server side UI log record filteringRichard Purdie
Currently one of the bigger bottlenecks in bitbake is passing all the log messages over IPC to the UI. This is worthwhile if the UI is going to use them, pointless otherwise. The memory resident bitbake suffers from this performance issue particularly badly. This patch filters the log events on the server side with the global log levels and hence reduces the traffic. This speeds up parsing (18.5s down to 17s) and bitbake general command overhead is reduced (7.3s for a NOP to 6.2s). What isn't added here is general event filtering or the ability to change the log levels once set. Provision is made for adding this in a follow up patch though. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-25knotty/msg: Avoid usage of curses initscr/endwin to avoid terminal corruptionRichard Purdie
Using curses initscr/endwin causes screen corruption if for example you suspend bitbake and resume it. This changes the code to use a less invasive approach to determining colour availability on the terminal. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-19knotty: Colorize knotty interactive console outputSeth Bollinger
Add bold color output to log level name and standard color output to log msg when bitbake is run from an iteractive console. Color output is only enabled if the terminal supports color. Used Jason Wessel's recommendation for transparency on verbose, note and plain. Signed-off-by: Seth Bollinger <seth.boll@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-28bitbake: implement BB_VERBOSE_LOGSPaul Eggleton
Enable configuring whether "set +x" is added to all shell tasks rather than forcing it; this is enabled by setting BB_VERBOSE_LOGS to 1. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-25bitbake/lib/bb/msg.py: fix setting debug and verbosity levelsPaul Eggleton
The debug and verbosity levels (as set by the -D and -v command line options respectively) were not being passed through within msg.py since bitbake revision 45aad2f9647df14bcfa5e755b57e1ddab377939a due to incorrect variable names. Fixes [YOCTO #1513]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2011-08-15Fixup remaining bb.msg.domain usersRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-15bitbake/msg.py: Drop manually created domain listsRichard Purdie
This patch removes the majority of the domain related code from bb.msg on the grounds that we now support dynamic creation of logging domains so having this hardcoded is just error prone and less flexible. It also makes the msg code overly and needlessly complex. It also removes the bb.msg.debug/note/warn/plain/error functions since we might as well remove them rather than try and fix them at this point. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-15bitbake/logging: Overhaul internal logging processRichard Purdie
At the moment it bugs me a lot that we only have one effective logging level for bitbake, despite the logging module having provision to do more advanced things. This patch: * Changes the core log level to the lowest level we have messages of (DEBUG-2) so messages always flow through the core logger * Allows build.py's task logging code to log all the output regardless of what output is on the console and sets this so log files now always contain debug level messages even if these don't appear on the console * Moves the verbose/debug/debug-domains code to be a UI side setting * Adds a filter to the UI to only print the user requested output. The result is more complete logfiles on disk but the usual output to the console. There are some behaviour changes intentionally made by this patch: a) the -v option now controls whether output is tee'd to the console. Ultimately, we likely want to output a message to the user about where the log file is and avoid placing output directly onto the console for every executing task. b) The functions get_debug_levels, the debug_levels variable, the set_debug_levels, the set_verbosity and set_debug_domains functions are removed from bb.msg. c) The "logging" init function changes format. d) All messages get fired to all handlers all the time leading to an increase in inter-process traffic. This could likely be hacked around short term with a function for a UI to only request events greater than level X. Longer term, having masks for event handlers would be better. e) logger.getEffectiveLevel() is no longer a reliable guide to what will/won't get logged so for now we look at the default log levels instead. [YOCTO #304] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-27Revert the unintentionally pushed msg.py changeChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2011-06-26msg: fix domain enum useChristopher Larson
Signed-off-by: Christopher Larson <kergoth@gmail.com>
2011-06-26msg: use a simpler enumeration for the domainsChristopher Larson
Rather than using a namedtuple, which is rather ugly in this particular use case, we simply subclass a 'set' and provide a __getattr__. There is also another benefit beyond readability -- when debugging, as in tracebacks, you see a string for the value rather than a number as is the case with a namedtuple. Signed-off-by: Christopher Larson <kergoth@gmail.com>
2011-05-16Shift exception formatting into the UIChris Larson
Now we use bb.exceptions to pass pickleable traceback entries to the UI, and the UI is free to do whatever it wants to do with this information. By default, the log formatter for the UIs formats it with bb.exceptions. This also means that all exceptions should now show 3 lines of context and limit to 5 entries. Signed-off-by: Chris Larson <chris_larson@mentor.com>
2011-02-11Enable some DeprecationWarningsChris Larson
We'll be skipping the Pending Deprecation step given our release process. Signed-off-by: Chris Larson <chris_larson@mentor.com>
2011-02-10bitbake/msg: Ensure lower level debug messages have DEBUG prefix and reuse ↵Richard Purdie
log level values from formatter (From Poky rev: 7586adb360d8075d3e97184dfcafb1b13ce5f838) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-01-10msg: no need to hardcode the logging levelsChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2011-01-10bitbake/msg.py: Add named definitions for all logging levelsRichard Purdie
(From Poky rev: a13352cfaf4b5d19196151e362851b1516e6af15) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2010-12-17Fix logging level names for post-server-ui-splitChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-12-10build: send logging messages to the log file for python functionsChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-09-03Drop 'fn' arguments to bb.msg functionsChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-09-03Add pending deprecation warnings to the bb.msg functionsChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-09-03Switch bitbake internals to use logging directly rather than bb.msgChris Larson
We use a custom Logger subclass for our loggers This logger provides: - 'debug' method which accepts a debug level - 'plain' method which bypasses log formatting - 'verbose' method which is more detail than info, but less than debug Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-08-27Use the python logging module under the hood for bb.msgChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-07-06*: use print() as a functionBernhard Reutner-Fischer
to make python3 happy Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-06-08Fix the silent exit when the specified task doesn't existChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-04-09Apply the 2to3 print function transformChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-04-09Import fixupsChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-04-09Formatting cleanupsChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-04-09Add a function to get the debug level, without poking into debug_levels manuallyChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>