Commit Graph

5 Commits

Author SHA1 Message Date
Alessandro Di Federico cb8a987122 Introduce Logger
`Logger` is the new infrastructrure for debug messages. They are
supposed to be used by just creating a global variable in a translation
unit and then writing there directly as if they were a stream.

Key features:

* Self-registration: a `Logger` by default register itself automatically
  in a register. This means that at run-time, unlike with `DBG`, we have
  a list of all the possible `Logger`s. One benefit of this approach is
  being able to list all the available `Logger`s in `--help`.
* Indentation: `Logger`s can be indented. In particular the
  `LoggerIndent` helper class can automatically indent a certain
  `Logger` during the lifetime of its instance.
* Atomic messages: a message is no longer simply delimited by a "\n": to
  mark the end of a message, an instance of `LogTerminator` has to be
  streamed to the `Logger`. This can also be associated directly to the
  lifetime of an object by using the `LogOnReturn` class.
* Custom class formatting: it is possible to decide how a certain object
  should be formatted when sent to a `Logger` by implementing the
  `writeToLog` function. For example, `llvm::Value`-derived objects are
  passed through the `getName` function. If no custom formatter is
  specified, the `operator<<` is employed.
2018-05-30 12:45:45 +02:00
Alessandro Di Federico e407fc11a1 Various minor cleanups 2018-05-30 12:45:45 +02:00
Alessandro Di Federico f5a950ad26 Move assertModuleIsMaterialized to debug.cpp 2017-08-12 11:28:07 +02:00
Alessandro Di Federico d01ee1f437 Copyright notices, license and credits 2016-09-21 01:45:26 +02:00
Alessandro Di Federico 0d58bc3cf7 Introduce logging framework 2016-01-12 22:43:04 +01:00