9b5388f3d665ccc58983350961ad15a703665f92
[ric-plt/submgr.git] / pkg / xapptweaks / logwrapper.go
1 /*
2 ==================================================================================
3   Copyright (c) 2019 AT&T Intellectual Property.
4   Copyright (c) 2019 Nokia
5
6    Licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8    You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17 ==================================================================================
18 */
19
20 package xapptweaks
21
22 import (
23         "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
24         "strings"
25 )
26
27 //-----------------------------------------------------------------------------
28 //
29 //-----------------------------------------------------------------------------
30 type LogWrapper struct {
31         desc   string
32         Logger *xapp.Log
33 }
34
35 func (tc *LogWrapper) GetDesc() string {
36         return tc.desc
37 }
38
39 func (tc *LogWrapper) GetLogger() *xapp.Log {
40         return tc.Logger
41 }
42
43 func (tc *LogWrapper) Init(desc string) {
44         tc.desc = strings.ToUpper(desc)
45         if len(desc) == 0 {
46                 tc.Logger = xapp.Logger
47         } else {
48                 tc.Logger = xapp.NewLogger(tc.desc)
49         }
50 }