Maint: pass only single strings to logger methods
- Do not assume formatting from logger's interface - Allow to change golibs in the future to accept only strings for logger methods
This commit is contained in:
@@ -19,7 +19,7 @@ var (
|
||||
func (r *routing) addRouteVia(destination net.IPNet, gateway net.IP, iface string, table int) error {
|
||||
destinationStr := destination.String()
|
||||
if r.verbose {
|
||||
r.logger.Info("adding route for %s", destinationStr)
|
||||
r.logger.Info("adding route for " + destinationStr)
|
||||
}
|
||||
if r.debug {
|
||||
fmt.Printf("ip route replace %s via %s dev %s table %d\n", destinationStr, gateway, iface, table)
|
||||
@@ -45,7 +45,7 @@ func (r *routing) addRouteVia(destination net.IPNet, gateway net.IP, iface strin
|
||||
func (r *routing) deleteRouteVia(destination net.IPNet, gateway net.IP, iface string, table int) (err error) {
|
||||
destinationStr := destination.String()
|
||||
if r.verbose {
|
||||
r.logger.Info("deleting route for %s", destinationStr)
|
||||
r.logger.Info("deleting route for " + destinationStr)
|
||||
}
|
||||
if r.debug {
|
||||
fmt.Printf("ip route delete %s via %s dev %s table %d\n", destinationStr, gateway, iface, table)
|
||||
|
||||
@@ -39,7 +39,7 @@ func (r *routing) removeOutboundSubnets(subnets []net.IPNet,
|
||||
for _, subnet := range subnets {
|
||||
const table = 0
|
||||
if err := r.deleteRouteVia(subnet, defaultGateway, defaultInterfaceName, table); err != nil {
|
||||
r.logger.Error("cannot remove outdated outbound subnet from routing: %s", err)
|
||||
r.logger.Error("cannot remove outdated outbound subnet from routing: " + err.Error())
|
||||
continue
|
||||
}
|
||||
r.outboundSubnets = removeSubnetFromSubnets(r.outboundSubnets, subnet)
|
||||
|
||||
@@ -50,7 +50,8 @@ func (r *routing) DefaultRoute() (defaultInterface string, defaultGateway net.IP
|
||||
attributes := link.Attrs()
|
||||
defaultInterface = attributes.Name
|
||||
if r.verbose {
|
||||
r.logger.Info("default route found: interface %s, gateway %s", defaultInterface, defaultGateway.String())
|
||||
r.logger.Info("default route found: interface " + defaultInterface +
|
||||
", gateway " + defaultGateway.String())
|
||||
}
|
||||
return defaultInterface, defaultGateway, nil
|
||||
}
|
||||
@@ -105,7 +106,7 @@ func (r *routing) LocalSubnet() (defaultSubnet net.IPNet, err error) {
|
||||
}
|
||||
defaultSubnet = *route.Dst
|
||||
if r.verbose {
|
||||
r.logger.Info("local subnet found: %s", defaultSubnet.String())
|
||||
r.logger.Info("local subnet found: " + defaultSubnet.String())
|
||||
}
|
||||
return defaultSubnet, nil
|
||||
}
|
||||
@@ -128,7 +129,7 @@ func (r *routing) LocalNetworks() (localNetworks []LocalNetwork, err error) {
|
||||
|
||||
localLinks[link.Attrs().Index] = struct{}{}
|
||||
if r.verbose {
|
||||
r.logger.Info("local ethernet link found: %s", link.Attrs().Name)
|
||||
r.logger.Info("local ethernet link found: " + link.Attrs().Name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +153,7 @@ func (r *routing) LocalNetworks() (localNetworks []LocalNetwork, err error) {
|
||||
|
||||
localNet.IPNet = route.Dst
|
||||
if r.verbose {
|
||||
r.logger.Info("local ipnet found: %s", localNet.IPNet.String())
|
||||
r.logger.Info("local ipnet found: " + localNet.IPNet.String())
|
||||
}
|
||||
|
||||
link, err := netlink.LinkByIndex(route.LinkIndex)
|
||||
|
||||
Reference in New Issue
Block a user