Changeset f039dba in mainline for uspace/srv/logger/ctl.c


Ignore:
Timestamp:
2012-08-17T09:57:27Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b1912b0c
Parents:
f72ae3b
Message:

Logger also works with hierarchy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/logger/ctl.c

    rf72ae3b rf039dba  
    4343#include "logger.h"
    4444
    45 static int handle_toplog_level_change(sysarg_t new_level)
     45static int handle_log_level_change(sysarg_t new_level)
    4646{
    47         void *top_name;
    48         int rc = async_data_write_accept(&top_name, true, 0, 0, 0, NULL);
     47        void *full_name;
     48        int rc = async_data_write_accept(&full_name, true, 0, 0, 0, NULL);
    4949        if (rc != EOK) {
    5050                return rc;
    5151        }
    5252
    53         logger_toplevel_log_t *toplog = find_or_create_toplevel_log(top_name);
    54         free(top_name);
    55         if (toplog == NULL)
     53        logger_log_t *log = find_log_by_name(full_name);
     54        free(full_name);
     55        if (log == NULL)
    5656                return ENOENT;
    5757
    58         toplog->logged_level = new_level;
     58        log->logged_level = new_level;
    5959
    6060        return EOK;
    61 }
    62 
    63 static int handle_log_level_change(sysarg_t new_level)
    64 {
    65         void *top_name;
    66         int rc = async_data_write_accept(&top_name, true, 0, 0, 0, NULL);
    67         if (rc != EOK) {
    68                 return rc;
    69         }
    70 
    71         logger_toplevel_log_t *toplog = find_or_create_toplevel_log(top_name);
    72         free(top_name);
    73         if (toplog == NULL)
    74                 return ENOENT;
    75 
    76 
    77         void *log_name;
    78         rc = async_data_write_accept(&log_name, true, 0, 0, 0, NULL);
    79         if (rc != EOK)
    80                 return rc;
    81 
    82         rc = ENOENT;
    83         for (size_t i = 0; i < toplog->sublog_count; i++) {
    84                 if (str_cmp(toplog->sublogs[i].name, (const char *) log_name) == 0) {
    85                         toplog->sublogs[i].logged_level = new_level;
    86                         rc = EOK;
    87                         break;
    88                 }
    89         }
    90 
    91         free(log_name);
    92 
    93         return rc;
    9461}
    9562
     
    10976                case LOGGER_CTL_SET_DEFAULT_LEVEL: {
    11077                        int rc = set_default_logging_level(IPC_GET_ARG1(call));
    111                         async_answer_0(callid, rc);
    112                         break;
    113                 }
    114                 case LOGGER_CTL_SET_TOP_LOG_LEVEL: {
    115                         int rc = handle_toplog_level_change(IPC_GET_ARG1(call));
    11678                        async_answer_0(callid, rc);
    11779                        break;
Note: See TracChangeset for help on using the changeset viewer.