Changeset f039dba in mainline for uspace/srv/logger/writer.c
- Timestamp:
- 2012-08-17T09:57:27Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b1912b0c
- Parents:
- f72ae3b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/logger/writer.c
rf72ae3b rf039dba 49 49 50 50 51 static logger_ toplevel_log_t *handle_create_toplevel_log(void)51 static logger_log_t *handle_create_log(sysarg_t parent) 52 52 { 53 53 void *name; … … 56 56 return NULL; 57 57 58 logger_ toplevel_log_t *log = find_or_create_toplevel_log(name);58 logger_log_t *log = find_or_create_log(name, parent); 59 59 60 60 free(name); … … 63 63 } 64 64 65 static int handle_receive_message(sysarg_t toplevel_log_id, sysarg_tlog_id, sysarg_t level)65 static int handle_receive_message(sysarg_t log_id, sysarg_t level) 66 66 { 67 logger_ toplevel_log_t *log = find_toplevel_log(toplevel_log_id);67 logger_log_t *log = find_log_by_id(log_id); 68 68 if (log == NULL) 69 return ENOENT;70 71 if (log_id > log->sublog_count)72 69 return ENOENT; 73 70 … … 77 74 return rc; 78 75 79 if (!shall_log_message(log, l og_id, level)) {76 if (!shall_log_message(log, level)) { 80 77 free(message); 81 78 return EOK; 82 79 } 83 80 84 printf("[%s/%s] %s: %s\n", 85 log->name, log->sublogs[log_id].name, 86 log_level_str(level), 81 printf("[%s] %s: %s\n", 82 log->full_name, log_level_str(level), 87 83 (const char *) message); 88 84 … … 90 86 91 87 return EOK; 92 }93 94 static int handle_create_sub_log(sysarg_t toplevel_log_id, sysarg_t *log_id)95 {96 logger_toplevel_log_t *log = find_toplevel_log(toplevel_log_id);97 if (log == NULL)98 return ENOENT;99 100 void *name;101 int rc = async_data_write_accept(&name, true, 0, 0, 0, NULL);102 if (rc != EOK)103 return rc;104 105 rc = add_sub_log(log, name, log_id);106 107 free(name);108 109 return rc;110 88 } 111 89 … … 125 103 126 104 switch (IPC_GET_IMETHOD(call)) { 127 case LOGGER_WRITER_CREATE_ TOPLEVEL_LOG: {128 logger_ toplevel_log_t *log = handle_create_toplevel_log();105 case LOGGER_WRITER_CREATE_LOG: { 106 logger_log_t *log = handle_create_log(IPC_GET_ARG1(call)); 129 107 if (log == NULL) { 130 108 async_answer_0(callid, ENOMEM); … … 136 114 case LOGGER_WRITER_MESSAGE: { 137 115 int rc = handle_receive_message(IPC_GET_ARG1(call), 138 IPC_GET_ARG2(call) , IPC_GET_ARG3(call));116 IPC_GET_ARG2(call)); 139 117 async_answer_0(callid, rc); 140 break;141 }142 case LOGGER_WRITER_CREATE_SUB_LOG: {143 sysarg_t log_id;144 int rc = handle_create_sub_log(IPC_GET_ARG1(call), &log_id);145 async_answer_1(callid, rc, log_id);146 118 break; 147 119 }
Note:
See TracChangeset
for help on using the changeset viewer.