X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=cmd%2Flogtester%2Fmain.go;fp=cmd%2Flogtester%2Fmain.go;h=74da0bdd8b69851755d19a24063f84f310775a20;hb=aaffc8ebe3f1dd3d3f77b80d5de3de7465994863;hp=0000000000000000000000000000000000000000;hpb=59f84608ec15c016958a6e0e0ddd813f376c0925;p=com%2Fgolog.git diff --git a/cmd/logtester/main.go b/cmd/logtester/main.go new file mode 100644 index 0000000..74da0bd --- /dev/null +++ b/cmd/logtester/main.go @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. + * Copyright (c) 2018-2019 Nokia. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package main + +import ( + "fmt" + "os" + "time" + + mdcloggo "gerrit.o-ran-sc.org/r/com/golog" +) + +func main() { + logger, _ := mdcloggo.InitLogger("myname") + logger.MdcAdd("foo", "bar") + logger.MdcAdd("foo2", "bar2") + start := time.Now() + for i := 0; i < 10; i++ { + logger.Info("Some test logs") + } + elapsed := time.Since(start) + fmt.Fprintf(os.Stderr, "Elapsed %v\n", elapsed) +}