Skip to content

Commit

Permalink
print log level when dump mclag status
Browse files Browse the repository at this point in the history
Signed-off-by: shine.chen <shine.chen@mediatek.com>
  • Loading branch information
shine.chen committed Nov 5, 2019
1 parent bc194ea commit 0b08967
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/iccpd/include/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct LoggerConfig

struct LoggerConfig* logger_get_configuration();
void logger_set_configuration(int log_level);
char* log_level_to_string(int level);
void log_setup(char* progname, char* path);
void log_finalize();
void log_init(struct CmdOptionParser* parser);
Expand Down
4 changes: 4 additions & 0 deletions src/iccpd/src/iccp_cmd_show.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int iccp_mclag_config_dump(char * *buf, int *num, int mclag_id)
struct CSM *csm = NULL;
struct LocalInterface *peer_link_if = NULL;
struct LocalInterface *lif_po = NULL;
struct LoggerConfig* logconfig;
char unknown[] = { "Unknown" };
int mclag_num = 0;
int id_exist = 0;
Expand Down Expand Up @@ -92,6 +93,9 @@ int iccp_mclag_config_dump(char * *buf, int *num, int mclag_id)
if (peer_link_if)
memcpy(state_info.peer_link_mac, peer_link_if->mac_addr, 6);

logconfig = logger_get_configuration();
memcpy(state_info.loglevel, log_level_to_string(logconfig->log_level), strlen( log_level_to_string(logconfig->log_level)));

state_info.role = csm->role_type;

str_size = MCLAGDCTL_PORT_MEMBER_BUF_LEN;
Expand Down
2 changes: 1 addition & 1 deletion src/iccpd/src/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static uint32_t _iccpd_log_level_map[] =
LOG_DEBUG,
};

static char* log_level_to_string(int level)
char* log_level_to_string(int level)
{
switch (level)
{
Expand Down
9 changes: 5 additions & 4 deletions src/iccpd/src/mclagdctl/mclagdctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ int mclagdctl_parse_dump_state(char *msg, int data_len)

fprintf(stdout, "%s: %s\n", "MCLAG Interface", state_info->enabled_po);

fprintf(stdout, "%s: %s\n", "Loglevel", state_info->loglevel);
}

return 0;
Expand Down Expand Up @@ -541,9 +542,9 @@ int mclagdctl_parse_config_loglevel(char *msg, int data_len)
int ret = *(int*)msg;

if (ret == 0)
fprintf(stdout, "%s\n", "Set mclag config debug level success!");
else
fprintf(stdout, "%s\n", "Set mclag config debug level failed!");
fprintf(stdout, "%s\n", "Config loglevel success!");
else
fprintf(stdout, "%s\n", "Config loglevel failed!");

return 0;
}
Expand Down Expand Up @@ -706,7 +707,7 @@ int main(int argc, char **argv)
char *data;
struct mclagd_reply_hdr *reply;

while ((opt = getopt_long(argc, argv, "hil:", long_options, NULL)) >= 0)
while ((opt = getopt_long(argc, argv, "hi:l:", long_options, NULL)) >= 0)
{
switch (opt)
{
Expand Down
1 change: 1 addition & 0 deletions src/iccpd/src/mclagdctl/mclagdctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ struct mclagd_state
unsigned char peer_link_mac[MCLAGDCTL_ETHER_ADDR_LEN];
int role;
char enabled_po[MCLAGDCTL_PORT_MEMBER_BUF_LEN];
char loglevel[MCLAGDCTL_PARA1_LEN];
};

struct mclagd_arp_msg
Expand Down

0 comments on commit 0b08967

Please sign in to comment.