Scott Baker | 104b67d | 2019-10-29 15:56:27 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package grpc |
| 17 | |
| 18 | import ( |
Girish Gowdra | 89c985b | 2020-10-14 15:02:09 -0700 | [diff] [blame] | 19 | "github.com/opencord/voltha-lib-go/v4/pkg/log" |
Scott Baker | 104b67d | 2019-10-29 15:56:27 -0700 | [diff] [blame] | 20 | ) |
| 21 | |
| 22 | const ( |
| 23 | /* |
khenaidoo | b332f9b | 2020-01-16 16:25:26 -0500 | [diff] [blame] | 24 | * This sets the GetLogLevel of the Voltha logger. It's pinned to FatalLevel here, as we |
Scott Baker | 104b67d | 2019-10-29 15:56:27 -0700 | [diff] [blame] | 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. |
| 38 | func 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 | } |