Skip to content

Commit 4930f68

Browse files
[no-relnote] Create a Mock logger interfact to enable testing
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent b934c68 commit 4930f68

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

internal/logger/mock.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
# Copyright (c) NVIDIA CORPORATION. All rights reserved.
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+
17+
package logger
18+
19+
// MockLogger is a mock implementation of the logger.Interface
20+
type MockLogger struct{}
21+
22+
// NewMockLogger returns a new mock logger
23+
func NewMockLogger() *MockLogger {
24+
return &MockLogger{}
25+
}
26+
27+
// Debugf is a no-op for the mock logger
28+
func (l *MockLogger) Debugf(format string, args ...interface{}) {}
29+
30+
// Errorf is a no-op for the mock logger
31+
func (l *MockLogger) Errorf(format string, args ...interface{}) {}
32+
33+
// Info is a no-op for the mock logger
34+
func (l *MockLogger) Info(args ...interface{}) {}
35+
36+
// Infof is a no-op for the mock logger
37+
func (l *MockLogger) Infof(format string, args ...interface{}) {}
38+
39+
// Warning is a no-op for the mock logger
40+
func (l *MockLogger) Warning(args ...interface{}) {}
41+
42+
// Warningf is a no-op for the mock logger
43+
func (l *MockLogger) Warningf(format string, args ...interface{}) {}
44+
45+
// Tracef is a no-op for the mock logger
46+
func (l *MockLogger) Tracef(format string, args ...interface{}) {}

0 commit comments

Comments
 (0)