Logy|Docs

Format patterns

Control readable console and file output

Format patterns control how human-readable records are printed.

main.go
err := logy.LoadConfig(&logy.Config{
	Console: &logy.ConsoleConfig{
		Enabled: true,
		Color:   true,
		Format:  "%d{2006-01-02 15:04:05.000} %p %c : %s%e%n",
	},
})
if err != nil {
	panic(err)
}

The pattern decides which parts of a record appear in the output:

  • %d{...} prints the timestamp using a Go time layout.
  • %p prints the level.
  • %c prints the logger name.
  • %s prints the rendered message.
  • %e prints error details when an error is attached.
  • %n prints a newline.

Use pattern output for local development, command line tools, and destinations where people read logs directly.