diff --git a/config/templates.go b/config/templates.go index 7005ae7ff08956977bea57d3bb109de8302ab951..e31558abd6370f032acbcf1f9033475905964a04 100644 --- a/config/templates.go +++ b/config/templates.go @@ -300,6 +300,9 @@ tendermint_host = "0.0.0.0:46657" ` +// TODO: [Silas]: before next logging release (finalising this stuff and adding +// presets) add full documentation of transforms, outputs, and their available +// configuration options. const sectionLoggingHeader = ` ################################################################################ ## @@ -308,8 +311,27 @@ const sectionLoggingHeader = ` ## Log messages are sent to one of two 'channels': info or trace ## ## They are delivered on two independent streams: 'info' or 'info and trace'. -## Each of these streams has a root +## Each of these streams has a root logging 'sink' (configured under the keys +## logging.info_sink and logging.info_and_trace_sink respectively) where each +## channels messages are delivered. +## +## A sink may optionally define any of a 'transform', an 'output', and a list of +## downstream sinks. Log messages flow through a sink by first having that +## sink's transform applied and then writing to its output and downstream sinks. +## In this way the log messages can output can be finely controlled and sent to +## a multiple different outputs having been filtered, modified, augmented, or +## labelled. This can be used to give more relevant output or to drive external +## systems. +## ## ################################################################################ +## A minimal logging config for multi-line, colourised terminal output would be: +# +# [logging] +# [logging.info_sink] +# [logging.info_and_trace_sink] +# [logging.info_and_trace_sink.output] +# output_type = "stderr" +# format = "terminal" ` diff --git a/logging/loggers/tendermint_log15_loggers.go b/logging/loggers/tendermint_log15_loggers.go index 982b232a3c45842b3da28d96654a4aba45dede54..14b2ea091927b3ad330622501268df6331cf5104 100644 --- a/logging/loggers/tendermint_log15_loggers.go +++ b/logging/loggers/tendermint_log15_loggers.go @@ -11,7 +11,10 @@ import ( "github.com/tendermint/log15" ) -const syslogPriority = syslog.LOG_LOCAL0 +const ( + syslogPriority = syslog.LOG_LOCAL0 + defaultFormatName = "terminal" +) func NewStreamLogger(writer io.Writer, formatName string) kitlog.Logger { return log15a.Log15HandlerAsKitLogger(log15.StreamHandler(writer, @@ -49,6 +52,6 @@ func format(name string) log15.Format { case "terminal": return log15.TerminalFormat() default: - return log15.LogfmtFormat() + return format(defaultFormatName) } }