From d8fd23467cdc8d7bdbb1ededd0cd859164aba652 Mon Sep 17 00:00:00 2001 From: Dave Clendenan Date: Fri, 2 Dec 2016 10:09:30 -0800 Subject: [PATCH] add syntax hilighting to new example blocks --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 32d145b..bb71050 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x20822 ``` To ensure this behaviour even if a TTY is attached, set your formatter as follows: -``` +```go log.SetFormatter(&log.TextFormatter{ DisableColors: true, FullTimestamp: true, @@ -60,7 +60,7 @@ To ensure this behaviour even if a TTY is attached, set your formatter as follow ``` If you wish to add the calling method as a field, instruct the logger via: -``` +```go log.SetReportCaller(true) ``` This adds the caller as 'method' like so: @@ -75,7 +75,7 @@ time="2015-03-26T01:27:38-04:00" level=fatal method=arcticcreatures.migrate msg= ``` Note that this does add measurable overhead - the cost will depend on the of Go, but is between 20 and 40% in recent tests with 1.6 and 1.7. You can validate this in your -environment via benchmarks: `go test -bench=.*CallerTracing` +environment via benchmarks: ```go test -bench=.*CallerTracing``` #### Example