本文整理汇总了Golang中github.com/Sirupsen/logrus.TextFormatter.DisableSorting方法的典型用法代码示例。如果您正苦于以下问题:Golang TextFormatter.DisableSorting方法的具体用法?Golang TextFormatter.DisableSorting怎么用?Golang TextFormatter.DisableSorting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Sirupsen/logrus.TextFormatter
的用法示例。
在下文中一共展示了TextFormatter.DisableSorting方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: makeJournal
// Build an adequate instance of the structured logger for this
// application instance. The journal builder may draw data from the
// app instance to configure the journal correctly. This method only
// instantiates a very basic journal; anything more complicated than
// that should be implementing using a boot.Provider to do it.
func (app *App) makeJournal(level logrus.Level) *logrus.Logger {
const m = "begin writing application journal"
var journal *logrus.Logger = &logrus.Logger{}
formatter := new(logrus.TextFormatter) // std
journal.Level = level // use requested level
journal.Out = os.Stdout // all goes to stdout
journal.Hooks = make(logrus.LevelHooks) // empty
journal.Formatter = formatter // set formatter
formatter.ForceColors = false // act smart
formatter.DisableColors = false // make pretty
formatter.DisableTimestamp = false // is useful
formatter.FullTimestamp = false // numbers
formatter.TimestampFormat = time.StampMilli
formatter.DisableSorting = false // order!
moment := time.Now().Format(app.TimeLayout)
journal.WithField("time", moment).Info(m)
return journal // is ready to use
}