blob: e6a3533b3d24ca007d34ed8f53d501567225a212 [file] [log] [blame]
Scott Baker104b67d2019-10-29 15:56:27 -07001/*
2 * Copyright 2019-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package grpc
17
18import (
Girish Gowdra89c985b2020-10-14 15:02:09 -070019 "github.com/opencord/voltha-lib-go/v4/pkg/log"
Scott Baker104b67d2019-10-29 15:56:27 -070020)
21
22const (
23 /*
khenaidoob332f9b2020-01-16 16:25:26 -050024 * This sets the GetLogLevel of the Voltha logger. It's pinned to FatalLevel here, as we
Scott Baker104b67d2019-10-29 15:56:27 -070025 * generally don't want to see logger output, even when running go test in verbose
26 * mode. Even "Error" level messages are expected to be output by some unit tests.
27 *
28 * If you are developing a unit test, and experiencing problems or wish additional
29 * debugging from Voltha, then changing this constant to log.DebugLevel may be
30 * useful.
31 */
32
33 VOLTHA_LOGLEVEL = log.FatalLevel
34)
35
36// Unit test initialization. This init() function handles all unit tests in
37// the current directory.
38func init() {
39 // Logger must be configured or bad things happen
40 _, err := log.SetDefaultLogger(log.JSON, VOLTHA_LOGLEVEL, log.Fields{"instanceId": 1})
41 if err != nil {
42 panic(err)
43 }
44}