Ejemplo n.º 1
0
func main() {
	logger.InitToConsole(logger.LevelError)
	logger.Info.Println("The package Logger!")
	logger.Error.Println("This is error message!!!")
	logger.Trace.Println("This is trace out")

	buf := &bytes.Buffer{}
	logger.InitToWriter(logger.LevelTrace, buf)
	logger.Info.Println("Out to writer!")
	buf.WriteTo(os.Stdout)

}
Ejemplo n.º 2
0
Archivo: app.go Proyecto: arteev/dsql
func (a *Application) beforeAction() *Application {
	a.cli.Before = func(ctx *cli.Context) error {
		a.verbose = ctx.GlobalInt("verbose")
		logger.InitToConsole(logger.Level(a.verbose))
		logger.Info.Println("Verbose level:", logger.CurrentLevel)
		if ctx.GlobalIsSet("repo") {
			repofile.SetRepositoryFile(ctx.GlobalString("repo"))
		} else if ctx.GlobalIsSet("r") {
			repofile.SetRepositoryFile(ctx.GlobalString("r"))
		}

		logger.Info.Println("Verbose level:", logger.CurrentLevel)
		logger.Info.Println("Repository location:", repofile.GetRepositoryFile(), "Default:", repofile.IsDefault())
		return nil
	}
	return a
}