blob: 44f8d65d4915238f2dd61ddfad7b5973a6f7f74f [file] [log] [blame]
Scott Bakerf5ec3a72019-11-05 08:43:52 -08001/*
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 core
17
18import (
serkant.uluderya2ae470f2020-01-21 11:13:09 -080019 "github.com/opencord/voltha-lib-go/v3/pkg/log"
Scott Bakerf5ec3a72019-11-05 08:43:52 -080020)
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
npujar03b018e2019-11-13 15:29:36 +053033 VolthaLogLevel = log.FatalLevel
Scott Bakerf5ec3a72019-11-05 08:43:52 -080034)
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
npujar03b018e2019-11-13 15:29:36 +053040 _, err := log.SetDefaultLogger(log.JSON, VolthaLogLevel, log.Fields{"instanceID": 1})
Scott Bakerf5ec3a72019-11-05 08:43:52 -080041 if err != nil {
42 panic(err)
43 }
44}