From: Sandeep Dasgupta <sdas...@google.com> A logging API that is simpler but inspired by that in abseil.
Signed-off-by: Ian Rogers <irog...@google.com> Signed-off-by: Sandeep Dasgupta <sdas...@google.com> --- .../perf/pmu-events/topdown-parser/logging.h | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tools/perf/pmu-events/topdown-parser/logging.h diff --git a/tools/perf/pmu-events/topdown-parser/logging.h b/tools/perf/pmu-events/topdown-parser/logging.h new file mode 100644 index 000000000000..9942018c4c75 --- /dev/null +++ b/tools/perf/pmu-events/topdown-parser/logging.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +// ------------------------------------- +// File: logging.h +// ------------------------------------- +// +// The header provides the macro defintion for logging errors/warnings + +#ifndef TOPDOWN_PARSER_LOGGING_H_ +#define TOPDOWN_PARSER_LOGGING_H_ + +#include <iostream> + +#define INFO(msg) std::cout << "\033[1;35mInfo: " << msg << "\033[0m\n" +#define ERROR(msg) \ + std::cout << __FILE__ << ":" << __LINE__ \ + << " \033[1;31mError: " << msg << "\033[0m\n" +#define FATAL(msg) \ + do { \ + std::cout << __FILE__ << ":" << __LINE__ \ + << " \033[1;31mFatal: " << msg << "\033[0m\n"; \ + exit(1); \ + } while (false) + +#endif // TOPDOWN_PARSER_LOGGING_H_ -- 2.29.2.222.g5d2a92d10f8-goog