github.com/osrg/gobgp/v3@v3.30.0/cmd/gobgpd/util_windows.go (about) 1 // Copyright (C) 2017 Nippon Telegraph and Telephone Corporation. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 // implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 //go:build windows 16 // +build windows 17 18 package main 19 20 import ( 21 "errors" 22 23 "github.com/osrg/gobgp/v3/pkg/log" 24 "github.com/sirupsen/logrus" 25 ) 26 27 func addSyslogHook(_, _ string) error { 28 return errors.New("syslog is not supported on this OS") 29 } 30 31 type builtinLogger struct { 32 logger *logrus.Logger 33 } 34 35 func (l *builtinLogger) Panic(msg string, fields log.Fields) { 36 l.logger.WithFields(logrus.Fields(fields)).Panic(msg) 37 } 38 39 func (l *builtinLogger) Fatal(msg string, fields log.Fields) { 40 l.logger.WithFields(logrus.Fields(fields)).Fatal(msg) 41 } 42 43 func (l *builtinLogger) Error(msg string, fields log.Fields) { 44 l.logger.WithFields(logrus.Fields(fields)).Error(msg) 45 } 46 47 func (l *builtinLogger) Warn(msg string, fields log.Fields) { 48 l.logger.WithFields(logrus.Fields(fields)).Warn(msg) 49 } 50 51 func (l *builtinLogger) Info(msg string, fields log.Fields) { 52 l.logger.WithFields(logrus.Fields(fields)).Info(msg) 53 } 54 55 func (l *builtinLogger) Debug(msg string, fields log.Fields) { 56 l.logger.WithFields(logrus.Fields(fields)).Debug(msg) 57 } 58 59 func (l *builtinLogger) SetLevel(level log.LogLevel) { 60 l.logger.SetLevel(logrus.Level(level)) 61 } 62 63 func (l *builtinLogger) GetLevel() log.LogLevel { 64 return log.LogLevel(l.logger.GetLevel()) 65 }