Changeset 669f5cae in mainline
- Timestamp:
- 2012-08-16T08:44:34Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6e9e12b
- Parents:
- cddcc4a3
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
rcddcc4a3 r669f5cae 166 166 $(USPACE_PATH)/app/loc/loc \ 167 167 $(USPACE_PATH)/app/logview/logview \ 168 $(USPACE_PATH)/app/logset/logset \ 168 169 $(USPACE_PATH)/app/mkfat/mkfat \ 169 170 $(USPACE_PATH)/app/mkexfat/mkexfat \ -
uspace/Makefile
rcddcc4a3 r669f5cae 47 47 app/klog \ 48 48 app/loc \ 49 app/logset \ 49 50 app/logview \ 50 51 app/mkfat \ -
uspace/lib/c/Makefile
rcddcc4a3 r669f5cae 97 97 generic/io/printf.c \ 98 98 generic/io/log.c \ 99 generic/io/logctl.c \ 99 100 generic/io/klog.c \ 100 101 generic/io/snprintf.c \ -
uspace/lib/c/include/ipc/logger.h
rcddcc4a3 r669f5cae 37 37 38 38 typedef enum { 39 LOGGER_CTL_GET_DEFAULT_LEVEL = IPC_FIRST_USER_METHOD, 40 LOGGER_CTL_SET_DEFAULT_LEVEL 41 } logger_control_request_t; 42 43 typedef enum { 39 44 LOGGER_REGISTER = IPC_FIRST_USER_METHOD, 40 45 LOGGER_MESSAGE, … … 48 53 49 54 typedef enum { 55 /** Interface for controlling logger behavior. */ 56 LOGGER_INTERFACE_CONTROL, 50 57 /** Interface for servers writing to the log. */ 51 58 LOGGER_INTERFACE_SINK, -
uspace/srv/logger/Makefile
rcddcc4a3 r669f5cae 32 32 33 33 SOURCES = \ 34 level.c \ 34 35 main.c \ 35 36 namespace.c -
uspace/srv/logger/logger.h
rcddcc4a3 r669f5cae 42 42 #include <fibril_synch.h> 43 43 44 #define DEFAULT_LOGGING_LEVEL LVL_NOTE45 46 44 #define NAME "logger" 47 45 #define MAX_NAMESPACE_LENGTH 256 … … 71 69 log_message_t *namespace_get_next_message(logging_namespace_t *); 72 70 71 log_level_t get_default_logging_level(void); 72 int set_default_logging_level(log_level_t); 73 73 74 #endif 74 75 -
uspace/srv/logger/main.c
rcddcc4a3 r669f5cae 47 47 #include "logger.h" 48 48 49 static void connection_handler_control(void) 50 { 51 printf(NAME "/control: new client.\n"); 52 53 while (true) { 54 ipc_call_t call; 55 ipc_callid_t callid = async_get_call(&call); 56 57 if (!IPC_GET_IMETHOD(call)) 58 break; 59 60 int rc; 61 62 switch (IPC_GET_IMETHOD(call)) { 63 case LOGGER_CTL_GET_DEFAULT_LEVEL: 64 async_answer_1(callid, EOK, get_default_logging_level()); 65 break; 66 case LOGGER_CTL_SET_DEFAULT_LEVEL: 67 rc = set_default_logging_level(IPC_GET_ARG1(call)); 68 async_answer_0(callid, rc); 69 break; 70 default: 71 async_answer_0(callid, EINVAL); 72 break; 73 } 74 } 75 76 printf(NAME "/control: client terminated.\n"); 77 } 78 49 79 static logging_namespace_t *find_namespace_and_attach_writer(void) 50 80 { … … 74 104 static int handle_receive_message(logging_namespace_t *namespace, int level) 75 105 { 76 bool skip_message = (level > DEFAULT_LOGGING_LEVEL) && !namespace_has_reader(namespace, level);106 bool skip_message = (level > (int)get_default_logging_level()) && !namespace_has_reader(namespace, level); 77 107 if (skip_message) { 78 108 /* Abort the actual message buffer transfer. */ … … 221 251 222 252 switch (iface) { 253 case LOGGER_INTERFACE_CONTROL: 254 async_answer_0(iid, EOK); 255 connection_handler_control(); 256 break; 223 257 case LOGGER_INTERFACE_SINK: 224 258 /* First call has to be the registration. */ -
uspace/srv/logger/namespace.c
rcddcc4a3 r669f5cae 126 126 } 127 127 128 namespace->logfile_level = DEFAULT_LOGGING_LEVEL;128 namespace->logfile_level = get_default_logging_level(); 129 129 130 130 fibril_mutex_initialize(&namespace->guard); … … 267 267 void namespace_add_message(logging_namespace_t *namespace, const char *message, log_level_t level) 268 268 { 269 if (level <= DEFAULT_LOGGING_LEVEL) {269 if (level <= get_default_logging_level()) { 270 270 printf("[%s %d]: %s\n", namespace->name, level, message); 271 271 }
Note:
See TracChangeset
for help on using the changeset viewer.