mirror of
https://github.com/systemd/systemd.git
synced 2024-12-03 23:33:38 +08:00
networkd: link - left-align debug messages
Still add some whitespace betwen ifname and the message to get the messages aligned (as I find it easier to spot specific messages this way).
This commit is contained in:
parent
dd43110f78
commit
97578344f3
@ -296,7 +296,7 @@ static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
|
||||
r = sd_rtnl_message_get_errno(m);
|
||||
if (r < 0 && r != -EEXIST)
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not set route: %s",
|
||||
"MESSAGE=%-*s: could not set route: %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, strerror(-r),
|
||||
"ERRNO=%d", -r,
|
||||
@ -462,7 +462,7 @@ static int route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
|
||||
r = sd_rtnl_message_get_errno(m);
|
||||
if (r < 0 && r != -ESRCH)
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not drop route: %s",
|
||||
"MESSAGE=%-*s: could not drop route: %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, strerror(-r),
|
||||
"ERRNO=%d", -r,
|
||||
@ -494,7 +494,7 @@ static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
|
||||
r = sd_rtnl_message_get_errno(m);
|
||||
if (r < 0 && r != -EEXIST)
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not set address: %s",
|
||||
"MESSAGE=%-*s: could not set address: %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, strerror(-r),
|
||||
"ERRNO=%d", -r,
|
||||
@ -641,7 +641,7 @@ static int address_update_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userd
|
||||
r = sd_rtnl_message_get_errno(m);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not update address: %s",
|
||||
"MESSAGE=%-*s: could not update address: %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, strerror(-r),
|
||||
"ERRNO=%d", -r,
|
||||
@ -668,7 +668,7 @@ static int address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdat
|
||||
r = sd_rtnl_message_get_errno(m);
|
||||
if (r < 0 && r != -EADDRNOTAVAIL)
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not drop address: %s",
|
||||
"MESSAGE=%-*s: could not drop address: %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, strerror(-r),
|
||||
"ERRNO=%d", -r,
|
||||
@ -753,8 +753,8 @@ static int set_mtu_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
|
||||
r = sd_rtnl_message_get_errno(m);
|
||||
if (r < 0)
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%s: could not set MTU: %s",
|
||||
link->ifname, strerror(-r),
|
||||
"MESSAGE=%-*s: could not set MTU: %s",
|
||||
IFNAMSIZ, link->ifname, strerror(-r),
|
||||
"ERRNO=%d", -r,
|
||||
NULL);
|
||||
|
||||
@ -922,7 +922,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
|
||||
|
||||
if (r >= 0)
|
||||
log_struct_link(LOG_INFO, link,
|
||||
"MESSAGE=%*s: DHCPv4 address %u.%u.%u.%u/%u via %u.%u.%u.%u",
|
||||
"MESSAGE=%-*s: DHCPv4 address %u.%u.%u.%u/%u via %u.%u.%u.%u",
|
||||
IFNAMSIZ,
|
||||
link->ifname,
|
||||
ADDRESS_FMT_VAL(address),
|
||||
@ -937,7 +937,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
|
||||
NULL);
|
||||
else
|
||||
log_struct_link(LOG_INFO, link,
|
||||
"MESSAGE=%*s: DHCPv4 address %u.%u.%u.%u/%u",
|
||||
"MESSAGE=%-*s: DHCPv4 address %u.%u.%u.%u/%u",
|
||||
IFNAMSIZ,
|
||||
link->ifname,
|
||||
ADDRESS_FMT_VAL(address),
|
||||
@ -1164,7 +1164,7 @@ static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) {
|
||||
return r;
|
||||
|
||||
log_struct_link(LOG_INFO, link,
|
||||
"MESSAGE=%*s: IPv4 link-local address %u.%u.%u.%u",
|
||||
"MESSAGE=%-*s: IPv4 link-local address %u.%u.%u.%u",
|
||||
IFNAMSIZ,
|
||||
link->ifname,
|
||||
ADDRESS_FMT_VAL(address),
|
||||
@ -1384,7 +1384,7 @@ static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
|
||||
/* we warn but don't fail the link, as it may
|
||||
be brought up later */
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not bring up interface: %s",
|
||||
"MESSAGE=%-*s: could not bring up interface: %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, strerror(-r),
|
||||
"ERRNO=%d", -r,
|
||||
@ -1471,7 +1471,7 @@ static int enslave_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
|
||||
r = sd_rtnl_message_get_errno(m);
|
||||
if (r < 0) {
|
||||
log_struct_link(LOG_ERR, link,
|
||||
"MESSAGE=%*s: could not enslave: %s",
|
||||
"MESSAGE=%-*s: could not enslave: %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, strerror(-r),
|
||||
"ERRNO=%d", -r,
|
||||
@ -1513,7 +1513,7 @@ static int link_enter_enslave(Link *link) {
|
||||
|
||||
if (link->network->bond) {
|
||||
log_struct_link(LOG_DEBUG, link,
|
||||
"MESSAGE=%*s: enslaving by '%s'",
|
||||
"MESSAGE=%-*s: enslaving by '%s'",
|
||||
IFNAMSIZ,
|
||||
link->ifname, link->network->bond->ifname,
|
||||
NETDEV(link->network->bond),
|
||||
@ -1522,7 +1522,7 @@ static int link_enter_enslave(Link *link) {
|
||||
r = netdev_enslave(link->network->bond, link, &enslave_handler);
|
||||
if (r < 0) {
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not enslave by '%s': %s",
|
||||
"MESSAGE=%-*s: could not enslave by '%s': %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, link->network->bond->ifname, strerror(-r),
|
||||
NETDEV(link->network->bond),
|
||||
@ -1537,7 +1537,7 @@ static int link_enter_enslave(Link *link) {
|
||||
|
||||
if (link->network->bridge) {
|
||||
log_struct_link(LOG_DEBUG, link,
|
||||
"MESSAGE=%*s: enslaving by '%s'",
|
||||
"MESSAGE=%-*s: enslaving by '%s'",
|
||||
IFNAMSIZ,
|
||||
link->ifname, link->network->bridge->ifname,
|
||||
NETDEV(link->network->bridge),
|
||||
@ -1546,7 +1546,7 @@ static int link_enter_enslave(Link *link) {
|
||||
r = netdev_enslave(link->network->bridge, link, &enslave_handler);
|
||||
if (r < 0) {
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not enslave by '%s': %s",
|
||||
"MESSAGE=%-*s: could not enslave by '%s': %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, link->network->bridge->ifname, strerror(-r),
|
||||
NETDEV(link->network->bridge),
|
||||
@ -1561,7 +1561,7 @@ static int link_enter_enslave(Link *link) {
|
||||
|
||||
if (link->network->tunnel) {
|
||||
log_struct_link(LOG_DEBUG, link,
|
||||
"MESSAGE=%*s: enslaving by '%s'",
|
||||
"MESSAGE=%-*s: enslaving by '%s'",
|
||||
IFNAMSIZ,
|
||||
link->ifname, link->network->tunnel->ifname,
|
||||
NETDEV(link->network->tunnel),
|
||||
@ -1570,7 +1570,7 @@ static int link_enter_enslave(Link *link) {
|
||||
r = netdev_enslave(link->network->tunnel, link, &enslave_handler);
|
||||
if (r < 0) {
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not enslave by '%s': %s",
|
||||
"MESSAGE=%-*s: could not enslave by '%s': %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, link->network->tunnel->ifname, strerror(-r),
|
||||
NETDEV(link->network->tunnel),
|
||||
@ -1585,14 +1585,14 @@ static int link_enter_enslave(Link *link) {
|
||||
|
||||
HASHMAP_FOREACH(vlan, link->network->vlans, i) {
|
||||
log_struct_link(LOG_DEBUG, link,
|
||||
"MESSAGE=%*s: enslaving by '%s'",
|
||||
"MESSAGE=%-*s: enslaving by '%s'",
|
||||
IFNAMSIZ,
|
||||
link->ifname, vlan->ifname, NETDEV(vlan), NULL);
|
||||
|
||||
r = netdev_enslave(vlan, link, &enslave_handler);
|
||||
if (r < 0) {
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not enslave by '%s': %s",
|
||||
"MESSAGE=%-*s: could not enslave by '%s': %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, vlan->ifname, strerror(-r),
|
||||
NETDEV(vlan), NULL);
|
||||
@ -1606,14 +1606,14 @@ static int link_enter_enslave(Link *link) {
|
||||
|
||||
HASHMAP_FOREACH(macvlan, link->network->macvlans, i) {
|
||||
log_struct_link(LOG_DEBUG, link,
|
||||
"MESSAGE=%*s: enslaving by '%s'",
|
||||
"MESSAGE=%-*s: enslaving by '%s'",
|
||||
IFNAMSIZ,
|
||||
link->ifname, macvlan->ifname, NETDEV(macvlan), NULL);
|
||||
|
||||
r = netdev_enslave(macvlan, link, &enslave_handler);
|
||||
if (r < 0) {
|
||||
log_struct_link(LOG_WARNING, link,
|
||||
"MESSAGE=%*s: could not enslave by '%s': %s",
|
||||
"MESSAGE=%-*s: could not enslave by '%s': %s",
|
||||
IFNAMSIZ,
|
||||
link->ifname, macvlan->ifname, strerror(-r),
|
||||
NETDEV(macvlan), NULL);
|
||||
|
@ -223,7 +223,7 @@ int network_get(Manager *manager, struct udev_device *device,
|
||||
udev_device_get_property_value(device, "ID_NET_DRIVER"),
|
||||
udev_device_get_devtype(device),
|
||||
ifname)) {
|
||||
log_debug("%*s: found matching network '%s'", IFNAMSIZ, ifname,
|
||||
log_debug("%-*s: found matching network '%s'", IFNAMSIZ, ifname,
|
||||
network->filename);
|
||||
*ret = network;
|
||||
return 0;
|
||||
|
@ -451,7 +451,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref);
|
||||
|
||||
/* Macros which append INTERFACE= to the message */
|
||||
|
||||
#define log_full_link(level, link, fmt, ...) log_meta_object(level, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__)
|
||||
#define log_full_link(level, link, fmt, ...) log_meta_object(level, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%-*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__)
|
||||
#define log_debug_link(link, ...) log_full_link(LOG_DEBUG, link, ##__VA_ARGS__)
|
||||
#define log_info_link(link, ...) log_full_link(LOG_INFO, link, ##__VA_ARGS__)
|
||||
#define log_notice_link(link, ...) log_full_link(LOG_NOTICE, link, ##__VA_ARGS__)
|
||||
@ -462,7 +462,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref);
|
||||
|
||||
/* More macros which append INTERFACE= to the message */
|
||||
|
||||
#define log_full_netdev(level, netdev, fmt, ...) log_meta_object(level, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->ifname, "%*s: " fmt, IFNAMSIZ, netdev->ifname, ##__VA_ARGS__)
|
||||
#define log_full_netdev(level, netdev, fmt, ...) log_meta_object(level, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->ifname, "%-*s: " fmt, IFNAMSIZ, netdev->ifname, ##__VA_ARGS__)
|
||||
#define log_debug_netdev(netdev, ...) log_full_netdev(LOG_DEBUG, netdev, ##__VA_ARGS__)
|
||||
#define log_info_netdev(netdev, ...) log_full_netdev(LOG_INFO, netdev, ##__VA_ARGS__)
|
||||
#define log_notice_netdev(netdev, ...) log_full_netdev(LOG_NOTICE, netdev, ##__VA_ARGS__)
|
||||
|
Loading…
Reference in New Issue
Block a user