log-example

command module
v0.0.0-...-cf52deb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

README

Example using github.com/leodotcloud/log package

package main

import (
	"time"

	"github.com/leodotcloud/log"
	"github.com/leodotcloud/log-example/one"
	"github.com/leodotcloud/log-example/two"
	"github.com/leodotcloud/log/server"
)

func main() {

	server.StartServerWithDefaults()

	one.Watch()
	two.Watch()

	id := "main"
	num := 0
	for {
		time.Sleep(time.Millisecond * 1000)
		log.Infof("%v :: Number: %v", id, num)
		num++
		time.Sleep(time.Millisecond * 1000)
		log.Errorf("%v :: Number: %v", id, num)
		num++
		time.Sleep(time.Millisecond * 1000)
		log.Debugf("%v :: Number: %v", id, num)
		num++
	}
}

See main.go for a more complex example.

Example using a container:

docker run --name=example -itd leodotcloud/log-example:dev
docker logs -f example

To change the log level dynamically:

docker exec -it example setLogLevelDebug
docker exec -it example getLogLevel
docker exec -it example setLogLevelInfo

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL