Bpftrace: Improve logging of bpftrace

Created on 8 Jul 2020  路  1Comment  路  Source: iovisor/bpftrace

Got these ideas from @fbs and @danobi.

Is your feature request related to a problem? Please describe.


Generally, it would be nice to provide logging facilities to developers and users so that they could have better visibility of bpftrace internal states.

  1. bpftrace currently doesn't provide tools for developers to print debug messages. It would be helpful if we can have some handy tools.
  2. There should be semantic warnings for users when they try to do things unproperly and having a consistent way to print the warnings can make it easier to do so. Also, bpftrace should allow users to enable and disable warnings like gcc does.
  3. bpftrace should provide options about what kind of debug information to print, as in #131.

Describe the solution you'd like


Implementing a logging framework for bpftrace. It would be much easier to deal with these issues with the right infrastructure.

  • [x] Add the logging infra. #1418
  • [x] Replace callsites of class BPFtrace logging facilities (warning() & error()). #1443
  • [x] Add the option to turn off warnings (maybe with -w as in gcc).#1444
  • [ ] Add the option to show certain debugging information (ast, ir).
  • [x] Change the error/warning messages sent through std::cerr.#1449

Describe alternative solutions or features you've considered


N/A

enhancement

Most helpful comment

In other projects I've really liked macro style loggers. For example:

LOG(ast) << "i'm an ast log";
LOG(codegen) << "i'm a codegen log";
LOG << "default log";

>All comments

In other projects I've really liked macro style loggers. For example:

LOG(ast) << "i'm an ast log";
LOG(codegen) << "i'm a codegen log";
LOG << "default log";
Was this page helpful?
0 / 5 - 0 ratings

Related issues

brendangregg picture brendangregg  路  7Comments

Brother-Lal picture Brother-Lal  路  6Comments

brendangregg picture brendangregg  路  8Comments

danobi picture danobi  路  8Comments

caringi picture caringi  路  4Comments