blob: 6ed7b26905fbf85cd15e4ac4cee4ac529f22716a [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 (
19 "github.com/opencord/voltha-lib-go/v2/pkg/log"
20)
21
22const (
23 /*
24 * This sets the LogLevel of the Voltha logger. It's pinned to FatalLevel here, as we
25 * 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}