From 938f9289fa614d53fa1fb4e505f10c99556dda04 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 22 Sep 2015 03:30:55 -0700 Subject: [PATCH] Trying this with examples. --- logging/{example/logger.go => example_test.go} | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) rename logging/{example/logger.go => example_test.go} (62%) diff --git a/logging/example/logger.go b/logging/example_test.go similarity index 62% rename from logging/example/logger.go rename to logging/example_test.go index 12f083b..52d6a81 100644 --- a/logging/example/logger.go +++ b/logging/example_test.go @@ -1,22 +1,20 @@ -package main +package logging -import "github.com/kisom/goutils/logging" +var log = Init() +var olog = New("subsystem #42", LevelNotice) -var log = logging.Init() -var olog = logging.New("subsystem #42", logging.LevelNotice) - -func main() { +func Example() { log.Notice("Hello, world.") log.Warning("this program is about to end") olog.Print("now online") - logging.Suppress("olog") + Suppress("olog") olog.Print("extraneous information") - logging.Enable("olog") + Enable("olog") olog.Print("relevant now") - logging.SuppressAll() + SuppressAll() log.Alert("screaming into the void") olog.Critical("can anyone hear me?") @@ -25,7 +23,7 @@ func main() { log.Suppress() log.Warning("but not for long") - logging.EnableAll() + EnableAll() log.Notice("fare thee well") olog.Print("all good journeys must come to an end") }