lkml.org 
[lkml]   [2020]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[RFC PATCH 01/12] perf topdown-parser: Add a simple logging API.
    From
    From: Sandeep Dasgupta <sdasgup@google.com>

    A logging API that is simpler but inspired by that in abseil.

    Signed-off-by: Ian Rogers <irogers@google.com>
    Signed-off-by: Sandeep Dasgupta <sdasgup@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
    \
     
     \ /
      Last update: 2020-11-10 11:05    [W:2.517 / U:0.288 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site