github.com/aristanetworks/goarista@v0.0.0-20240514173732-cca2755bbd44/glog/glog.go (about) 1 // Copyright (c) 2021 Arista Networks, Inc. 2 // Use of this source code is governed by the Apache License 2.0 3 // that can be found in the COPYING file. 4 5 package glog 6 7 import "github.com/aristanetworks/glog" 8 9 // Glog is an empty type that allows to pass glog as a logger, implementing logger.Logger 10 type Glog struct { 11 // default value of glog.Level is 0 12 InfoLevel glog.Level 13 } 14 15 // Info logs at the info level 16 func (g *Glog) Info(args ...interface{}) { 17 glog.V(g.InfoLevel).Info(args...) 18 } 19 20 // Infof logs at the info level, with format 21 func (g *Glog) Infof(format string, args ...interface{}) { 22 glog.V(g.InfoLevel).Infof(format, args...) 23 } 24 25 // Error logs at the error level 26 func (g *Glog) Error(args ...interface{}) { 27 glog.Error(args...) 28 } 29 30 // Errorf logs at the error level, with format 31 func (g *Glog) Errorf(format string, args ...interface{}) { 32 glog.Errorf(format, args...) 33 } 34 35 // Fatal logs at the fatal level 36 func (g *Glog) Fatal(args ...interface{}) { 37 glog.Fatal(args...) 38 } 39 40 // Fatalf logs at the fatal level, with format 41 func (g *Glog) Fatalf(format string, args ...interface{}) { 42 glog.Fatalf(format, args...) 43 }