-
Alessandro Di Federico authored
`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.
Alessandro Di Federico authored`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.
Loading