Presently, we have log.Logger which is a concrete implementation of a very basic logger. We use this in libcnb to log information. The buildpack calls only debug related methods, with one exception and that is a single call to an info method for logging a warning.
This PR proposes the following changes:
We have a Logger interface that defines debug methods only (more on this later). This can be implemented to control how libcnb logs.
We provide a basic implementation of Logger called PlainLogger that writes to stdout if $BP_LOG_LEVEL=debug or $BP_DEBUG=true. This is in the log module, so it can be bypassed if not needed.
We enable a Logger to be passed in through config options to the main/build/detect functions. Thus a buildpack author can provide their own implementation & control formatting.
We set a style rule that internally libcnb only writes debug level messages. This removes the need for Info/Warn level methods on the interface.
We set a style rule that internally libcnb does not write warnings. Any warning is an error. This is because the warnings that have been used are not messages to end-users, but messages to buildpack authors. Thus making it an error should force buildpack authors to deal with the problem. This should reduce user confusion as they won't see warning messages which they can do nothing about.
Presently, we have
log.Logger
which is a concrete implementation of a very basic logger. We use this in libcnb to log information. The buildpack calls only debug related methods, with one exception and that is a single call to an info method for logging a warning.This PR proposes the following changes:
$BP_LOG_LEVEL=debug
or$BP_DEBUG=true
. This is in the log module, so it can be bypassed if not needed.Resolves #113
Signed-off-by: Daniel Mikusa dmikusa@vmware.com