It's weird that this log level is abbreviated, but not the other ones.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Id14da1ba6cd38f7d824079218280bff9dea1e276
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1663
Tested-by: jenkins <jenkins@lttng.org>
|`BT_LOG_INFO`
|`BT_LOGGING_LEVEL_INFO`
-|_WARN_
+|_WARNING_
|`W`
-|`BT_LOG_WARN`
-|`BT_LOGGING_LEVEL_WARN`
+|`BT_LOG_WARNING`
+|`BT_LOGGING_LEVEL_WARNING`
|_ERROR_
|`E`
+
--
----
-$ BABELTRACE_MINIMAL_LOG_LEVEL=WARN ./configure
+$ BABELTRACE_MINIMAL_LOG_LEVEL=INFO ./configure
----
--
+
The default build-time log level is `DEBUG`. For optimal performance,
set it to `INFO`, which effectively disables all fast path logging in
-all the Babeltrace modules. You can't set it to `WARN`, `ERROR`,
+all the Babeltrace modules. You can't set it to `WARNING`, `ERROR`,
`FATAL`, or `NONE` because the impact on performance is minuscule
starting from the _INFO_ log level anyway and we want any Babeltrace
build to always be able to print _INFO_-level logs.
* `BT_LOG_ENABLED_TRACE`
* `BT_LOG_ENABLED_DEBUG`
* `BT_LOG_ENABLED_INFO`
-* `BT_LOG_ENABLED_WARN`
+* `BT_LOG_ENABLED_WARNING`
* `BT_LOG_ENABLED_ERROR`
* `BT_LOG_ENABLED_FATAL`
* `BT_LOG_ON_TRACE`
* `BT_LOG_ON_DEBUG`
* `BT_LOG_ON_INFO`
-* `BT_LOG_ON_WARN`
+* `BT_LOG_ON_WARNING`
* `BT_LOG_ON_ERROR`
* `BT_LOG_ON_FATAL`
* Almost any error in terminal elements: CLI and plugins.
|Almost none: always enabled.
-|_WARN_
+|_WARNING_
|
An error which still allows the execution to continue, but you judge
that it should be reported to the user.
-_WARN_-level logging statements are for any error or weird action that
-is directly or indirectly caused by the user, often through some bad
-input data. For example, not having enough memory is considered beyond
-the user's control, so we always log memory errors with an _ERROR_ level
-(not _FATAL_ because we usually don't abort in this condition).
+_WARNING_-level logging statements are for any error or weird action
+that is directly or indirectly caused by the user, often through some
+bad input data. For example, not having enough memory is considered
+beyond the user's control, so we always log memory errors with an
+_ERROR_ level (not _FATAL_ because we usually don't abort in this
+condition).
|
* Missing data within something that is expected to have it, but there's
an alternative.
[IMPORTANT]
--
-Make sure not to use a _WARN_ (or higher) log level when the
+Make sure not to use a _WARNING_ (or higher) log level when the
condition leading to the logging statement can occur under normal
circumstances.
When Babeltrace supports terminal color codes (depends on the
`BABELTRACE_TERM_COLOR` environment variable's value and what the
standard output and error streams are plugged into), _INFO_-level lines
-are blue, _WARN_-level lines are yellow, and _ERROR_-level and
+are blue, _WARNING_-level lines are yellow, and _ERROR_-level and
_FATAL_-level lines are red.
Log line example:
The library's and object's states remain consistent when a
warning is issued.
*/
- BT_LOGGING_LEVEL_WARN = 4,
+ BT_LOGGING_LEVEL_WARNING = 4,
/**
An important error from which the library cannot recover, but
TRACE = native_bt.LOGGING_LEVEL_TRACE
DEBUG = native_bt.LOGGING_LEVEL_DEBUG
INFO = native_bt.LOGGING_LEVEL_INFO
- WARN = native_bt.LOGGING_LEVEL_WARN
+ WARNING = native_bt.LOGGING_LEVEL_WARNING
ERROR = native_bt.LOGGING_LEVEL_ERROR
FATAL = native_bt.LOGGING_LEVEL_FATAL
NONE = native_bt.LOGGING_LEVEL_NONE
LoggingLevel.TRACE,
LoggingLevel.DEBUG,
LoggingLevel.INFO,
- LoggingLevel.WARN,
+ LoggingLevel.WARNING,
LoggingLevel.ERROR,
LoggingLevel.FATAL,
LoggingLevel.NONE,
static inline
void logw_exception(void)
{
- log_exception(BT_LOG_WARN);
+ log_exception(BT_LOG_WARNING);
}
static inline
bt2.logging.LoggingLevel.TRACE,
bt2.logging.LoggingLevel.DEBUG,
bt2.logging.LoggingLevel.INFO,
- bt2.logging.LoggingLevel.WARN,
+ bt2.logging.LoggingLevel.WARNING,
bt2.logging.LoggingLevel.ERROR,
bt2.logging.LoggingLevel.FATAL,
bt2.logging.LoggingLevel.NONE,
} while (0)
static bool is_first_error = true;
-static const int cli_default_log_level = BT_LOG_WARN;
+static const int cli_default_log_level = BT_LOG_WARNING;
/* INI-style parsing FSM states */
enum ini_parsing_fsm_state {
if (g_file_test(cfg->command_name,
G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
_bt_log_write_d(_BT_LOG_SRCLOC_FUNCTION, __FILE__, __LINE__,
- BT_LOG_WARN, BT_LOG_TAG,
+ BT_LOG_WARNING, BT_LOG_TAG,
"The `%s` command was executed. "
"If you meant to convert a trace located in "
"the local `%s` directory, please use:\n\n"
#define BT_CLI_LOGE_APPEND_CAUSE(_fmt, ...) \
BT_CLI_LOG_AND_APPEND(BT_LOG_ERROR, _fmt, ##__VA_ARGS__)
#define BT_CLI_LOGW_APPEND_CAUSE(_fmt, ...) \
- BT_CLI_LOG_AND_APPEND(BT_LOG_WARN, _fmt, ##__VA_ARGS__)
+ BT_CLI_LOG_AND_APPEND(BT_LOG_WARNING, _fmt, ##__VA_ARGS__)
#endif /* CLI_LOGGING_H */
return "BT_LOGGING_LEVEL_DEBUG";
case BT_LOGGING_LEVEL_INFO:
return "BT_LOGGING_LEVEL_INFO";
- case BT_LOGGING_LEVEL_WARN:
- return "BT_LOGGING_LEVEL_WARN";
+ case BT_LOGGING_LEVEL_WARNING:
+ return "BT_LOGGING_LEVEL_WARNING";
case BT_LOGGING_LEVEL_ERROR:
return "BT_LOGGING_LEVEL_ERROR";
case BT_LOGGING_LEVEL_FATAL:
/* See `CONTRIBUTING.adoc` for usage */
#define BT_LIB_LOGF(_fmt, ...) BT_LIB_LOG(BT_LOG_FATAL, _fmt, ##__VA_ARGS__)
#define BT_LIB_LOGE(_fmt, ...) BT_LIB_LOG(BT_LOG_ERROR, _fmt, ##__VA_ARGS__)
-#define BT_LIB_LOGW(_fmt, ...) BT_LIB_LOG(BT_LOG_WARN, _fmt, ##__VA_ARGS__)
+#define BT_LIB_LOGW(_fmt, ...) BT_LIB_LOG(BT_LOG_WARNING, _fmt, ##__VA_ARGS__)
#define BT_LIB_LOGI(_fmt, ...) BT_LIB_LOG(BT_LOG_INFO, _fmt, ##__VA_ARGS__)
#define BT_LIB_LOGD(_fmt, ...) BT_LIB_LOG(BT_LOG_DEBUG, _fmt, ##__VA_ARGS__)
#define BT_LIB_LOGT(_fmt, ...) BT_LIB_LOG(BT_LOG_TRACE, _fmt, ##__VA_ARGS__)
#define BT_LIB_LOGE_APPEND_CAUSE(_fmt, ...) \
BT_LIB_LOG_AND_APPEND(BT_LOG_ERROR, _fmt, ##__VA_ARGS__)
#define BT_LIB_LOGW_APPEND_CAUSE(_fmt, ...) \
- BT_LIB_LOG_AND_APPEND(BT_LOG_WARN, _fmt, ##__VA_ARGS__)
+ BT_LIB_LOG_AND_APPEND(BT_LOG_WARNING, _fmt, ##__VA_ARGS__)
/*
* Like bt_lib_log(), but also appends a cause to the current thread's
* level variable. In that case it must be defined elsewhere using
* BT_LOG_DEFINE_GLOBAL_OUTPUT_LEVEL macro, for example:
*
- * BT_LOG_DEFINE_GLOBAL_OUTPUT_LEVEL = BT_LOG_WARN;
+ * BT_LOG_DEFINE_GLOBAL_OUTPUT_LEVEL = BT_LOG_WARNING;
*
* This allows to specify custom value for static initialization and avoid
* overhead of setting this value in runtime.
return ANDROID_LOG_DEBUG;
case BT_LOG_INFO:
return ANDROID_LOG_INFO;
- case BT_LOG_WARN:
+ case BT_LOG_WARNING:
return ANDROID_LOG_WARN;
case BT_LOG_ERROR:
return ANDROID_LOG_ERROR;
return 7; /* ASL_LEVEL_DEBUG / kCFLogLevelDebug */;
case BT_LOG_INFO:
return 6; /* ASL_LEVEL_INFO / kCFLogLevelInfo */;
- case BT_LOG_WARN:
+ case BT_LOG_WARNING:
return 4; /* ASL_LEVEL_WARNING / kCFLogLevelWarning */;
case BT_LOG_ERROR:
return 3; /* ASL_LEVEL_ERR / kCFLogLevelError */;
return 'D';
case BT_LOG_INFO:
return 'I';
- case BT_LOG_WARN:
+ case BT_LOG_WARNING:
return 'W';
case BT_LOG_ERROR:
return 'E';
color_p = bt_common_color_fg_blue();
color_e = color_p + strlen(color_p);
break;
- case BT_LOG_WARN:
+ case BT_LOG_WARNING:
color_p = bt_common_color_fg_yellow();
color_e = color_p + strlen(color_p);
break;
* - BT_LOG_ERROR - happened something possible, but highly unexpected. The
* process is able to recover and continue execution.
* Example: out of memory (could also be FATAL if not handled properly).
- * - BT_LOG_WARN - happened something that *usually* should not happen and
+ * - BT_LOG_WARNING - happened something that *usually* should not happen and
* significantly changes application behavior for some period of time.
* Example: configuration file not found, auth error.
* - BT_LOG_INFO - happened significant life cycle event or major state
#define BT_LOG_TRACE BT_LOGGING_LEVEL_TRACE
#define BT_LOG_DEBUG BT_LOGGING_LEVEL_DEBUG
#define BT_LOG_INFO BT_LOGGING_LEVEL_INFO
-#define BT_LOG_WARN BT_LOGGING_LEVEL_WARN
+#define BT_LOG_WARNING BT_LOGGING_LEVEL_WARNING
#define BT_LOG_ERROR BT_LOGGING_LEVEL_ERROR
#define BT_LOG_FATAL BT_LOGGING_LEVEL_FATAL
#define BT_LOG_NONE BT_LOGGING_LEVEL_NONE
#define BT_LOG_ENABLED_TRACE BT_LOG_ENABLED(BT_LOG_TRACE)
#define BT_LOG_ENABLED_DEBUG BT_LOG_ENABLED(BT_LOG_DEBUG)
#define BT_LOG_ENABLED_INFO BT_LOG_ENABLED(BT_LOG_INFO)
-#define BT_LOG_ENABLED_WARN BT_LOG_ENABLED(BT_LOG_WARN)
+#define BT_LOG_ENABLED_WARNING BT_LOG_ENABLED(BT_LOG_WARNING)
#define BT_LOG_ENABLED_ERROR BT_LOG_ENABLED(BT_LOG_ERROR)
#define BT_LOG_ENABLED_FATAL BT_LOG_ENABLED(BT_LOG_FATAL)
#define BT_LOG_ON_TRACE BT_LOG_ON(BT_LOG_TRACE)
#define BT_LOG_ON_DEBUG BT_LOG_ON(BT_LOG_DEBUG)
#define BT_LOG_ON_INFO BT_LOG_ON(BT_LOG_INFO)
-#define BT_LOG_ON_WARN BT_LOG_ON(BT_LOG_WARN)
+#define BT_LOG_ON_WARNING BT_LOG_ON(BT_LOG_WARNING)
#define BT_LOG_ON_ERROR BT_LOG_ON(BT_LOG_ERROR)
#define BT_LOG_ON_FATAL BT_LOG_ON(BT_LOG_FATAL)
#define BT_LOGI_MEM_AUX(...) _BT_LOG_UNUSED(__VA_ARGS__)
#endif
-#if BT_LOG_ENABLED_WARN
+#if BT_LOG_ENABLED_WARNING
#define BT_LOGW(...) \
- BT_LOG_WRITE(BT_LOG_WARN, _BT_LOG_TAG, __VA_ARGS__)
+ BT_LOG_WRITE(BT_LOG_WARNING, _BT_LOG_TAG, __VA_ARGS__)
#define BT_LOGW_ERRNO(...) \
- BT_LOG_WRITE_ERRNO(BT_LOG_WARN, _BT_LOG_TAG, __VA_ARGS__)
+ BT_LOG_WRITE_ERRNO(BT_LOG_WARNING, _BT_LOG_TAG, __VA_ARGS__)
#define BT_LOGW_AUX(log, ...) \
- BT_LOG_WRITE_AUX(log, BT_LOG_WARN, _BT_LOG_TAG, __VA_ARGS__)
+ BT_LOG_WRITE_AUX(log, BT_LOG_WARNING, _BT_LOG_TAG, __VA_ARGS__)
#define BT_LOGW_MEM(d, d_sz, ...) \
- BT_LOG_WRITE_MEM(BT_LOG_WARN, _BT_LOG_TAG, d, d_sz, __VA_ARGS__)
+ BT_LOG_WRITE_MEM(BT_LOG_WARNING, _BT_LOG_TAG, d, d_sz, __VA_ARGS__)
#define BT_LOGW_MEM_AUX(log, d, d_sz, ...) \
- BT_LOG_WRITE_MEM_AUX(log, BT_LOG_WARN, _BT_LOG_TAG, d, d_sz, __VA_ARGS__)
+ BT_LOG_WRITE_MEM_AUX(log, BT_LOG_WARNING, _BT_LOG_TAG, d, d_sz, __VA_ARGS__)
#else
#define BT_LOGW(...) _BT_LOG_UNUSED(__VA_ARGS__)
#define BT_LOGW_AUX(...) _BT_LOG_UNUSED(__VA_ARGS__)
case BT_LOG_INFO:
letter = 'I';
break;
- case BT_LOG_WARN:
+ case BT_LOG_WARNING:
letter = 'W';
break;
case BT_LOG_ERROR:
} else if (strcmp(str, "WARN") == 0 ||
strcmp(str, "WARNING") == 0 ||
strcmp(str, "W") == 0) {
- level = BT_LOG_WARN;
+ level = BT_LOG_WARNING;
} else if (strcmp(str, "ERROR") == 0 ||
strcmp(str, "E") == 0) {
level = BT_LOG_ERROR;
#define BT_COMP_LOGE(_fmt, ...) \
BT_COMP_LOG(BT_LOG_ERROR, (BT_COMP_LOG_SELF_COMP), _fmt, ##__VA_ARGS__)
#define BT_COMP_LOGW(_fmt, ...) \
- BT_COMP_LOG(BT_LOG_WARN, (BT_COMP_LOG_SELF_COMP), _fmt, ##__VA_ARGS__)
+ BT_COMP_LOG(BT_LOG_WARNING, (BT_COMP_LOG_SELF_COMP), _fmt, ##__VA_ARGS__)
#define BT_COMP_LOGI(_fmt, ...) \
BT_COMP_LOG(BT_LOG_INFO, (BT_COMP_LOG_SELF_COMP), _fmt, ##__VA_ARGS__)
#define BT_COMP_LOGD(_fmt, ...) \
#define BT_COMP_LOGE_STR(_str) \
BT_COMP_LOG(BT_LOG_ERROR, (BT_COMP_LOG_SELF_COMP), "%s", (_str))
#define BT_COMP_LOGW_STR(_str) \
- BT_COMP_LOG(BT_LOG_WARN, (BT_COMP_LOG_SELF_COMP), "%s", (_str))
+ BT_COMP_LOG(BT_LOG_WARNING, (BT_COMP_LOG_SELF_COMP), "%s", (_str))
#define BT_COMP_LOGI_STR(_str) \
BT_COMP_LOG(BT_LOG_INFO, (BT_COMP_LOG_SELF_COMP), "%s", (_str))
#define BT_COMP_LOGD_STR(_str) \
#define BT_COMP_LOGE_ERRNO(_msg, _fmt, ...) \
BT_COMP_LOG_ERRNO(BT_LOG_ERROR, (BT_COMP_LOG_SELF_COMP), _msg, _fmt, ##__VA_ARGS__)
#define BT_COMP_LOGW_ERRNO(_msg, _fmt, ...) \
- BT_COMP_LOG_ERRNO(BT_LOG_WARN, (BT_COMP_LOG_SELF_COMP), _msg, _fmt, ##__VA_ARGS__)
+ BT_COMP_LOG_ERRNO(BT_LOG_WARNING, (BT_COMP_LOG_SELF_COMP), _msg, _fmt, ##__VA_ARGS__)
#define BT_COMP_LOGI_ERRNO(_msg, _fmt, ...) \
BT_COMP_LOG_ERRNO(BT_LOG_INFO, (BT_COMP_LOG_SELF_COMP), _msg, _fmt, ##__VA_ARGS__)
#define BT_COMP_LOGD_ERRNO(_msg, _fmt, ...) \
#define BT_COMP_LOGE_MEM(_data_ptr, _data_sz, _fmt, ...) \
BT_COMP_LOG_MEM(BT_LOG_ERROR, (BT_COMP_LOG_SELF_COMP), (_data_ptr), (_data_sz), _fmt, ##__VA_ARGS__)
#define BT_COMP_LOGW_MEM(_data_ptr, _data_sz, _fmt, ...) \
- BT_COMP_LOG_MEM(BT_LOG_WARN, (BT_COMP_LOG_SELF_COMP), (_data_ptr), (_data_sz), _fmt, ##__VA_ARGS__)
+ BT_COMP_LOG_MEM(BT_LOG_WARNING, (BT_COMP_LOG_SELF_COMP), (_data_ptr), (_data_sz), _fmt, ##__VA_ARGS__)
#define BT_COMP_LOGI_MEM(_data_ptr, _data_sz, _fmt, ...) \
BT_COMP_LOG_MEM(BT_LOG_INFO, (BT_COMP_LOG_SELF_COMP), (_data_ptr), (_data_sz), _fmt, ##__VA_ARGS__)
#define BT_COMP_LOGD_MEM(_data_ptr, _data_sz, _fmt, ...) \
#endif
log_python_traceback(ret == BT_FUNC_STATUS_ERROR ?
- BT_LOG_WARN : BT_LOG_INFO);
+ BT_LOG_WARNING : BT_LOG_INFO);
pyerr_clear();
Py_XDECREF(py_bt2_py_plugin_mod);
return ret;
error:
BT_ASSERT(status != BT_FUNC_STATUS_OK);
- log_python_traceback(fail_on_load_error ? BT_LOG_WARN : BT_LOG_INFO);
+ log_python_traceback(fail_on_load_error ? BT_LOG_WARNING : BT_LOG_INFO);
pyerr_clear();
BT_OBJECT_PUT_REF_AND_RESET(*plugin_out);
error:
BT_ASSERT(status != BT_FUNC_STATUS_OK);
- log_python_traceback(fail_on_load_error ? BT_LOG_WARN : BT_LOG_INFO);
+ log_python_traceback(fail_on_load_error ? BT_LOG_WARNING : BT_LOG_INFO);
pyerr_clear();
BT_OBJECT_PUT_REF_AND_RESET(*plugin_set_out);
def _consume(self):
pass
- comp = self._create_comp(MySink, 'yaes', bt2.LoggingLevel.WARN)
- self.assertEqual(comp.logging_level, bt2.LoggingLevel.WARN)
+ comp = self._create_comp(MySink, 'yaes', bt2.LoggingLevel.WARNING)
+ self.assertEqual(comp.logging_level, bt2.LoggingLevel.WARNING)
def test_class(self):
class MySink(bt2._UserSinkComponent):
query_log_level = None
res = bt2.QueryExecutor().query(MySink, 'obj', None,
- bt2.LoggingLevel.WARN)
- self.assertEqual(query_log_level, bt2.LoggingLevel.WARN)
+ bt2.LoggingLevel.WARNING)
+ self.assertEqual(query_log_level, bt2.LoggingLevel.WARNING)
del query_log_level
def test_query_simple(self):
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define BT_LOG_OUTPUT_LEVEL BT_LOG_WARN
+#define BT_LOG_OUTPUT_LEVEL BT_LOG_WARNING
#define BT_LOG_TAG "TEST/BIN-INFO"
#include "logging/log.h"