Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d6ddeb7 in mainline


Ignore:
Timestamp:
2012-08-16T17:17:30Z (9 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
e005f92
Parents:
ebbc8a74
Message:

Log context is actually a log

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/stdio/logger2.c

    rebbc8a74 rd6ddeb7  
    3636const char *test_logger2(void)
    3737{
    38         log_context_t ctx_alpha = log_context_create("alpha");
    39         log_context_t ctx_bravo = log_context_create("bravo");
     38        log_t log_alpha = log_create("alpha");
     39        log_t log_bravo = log_create("bravo");
    4040
    41         TPRINTF("Alpha context is %" PRIlogctx ".\n", ctx_alpha);
    42         TPRINTF("Bravo context is %" PRIlogctx ".\n", ctx_bravo);
     41        TPRINTF("Alpha context is %" PRIlogctx ".\n", log_alpha);
     42        TPRINTF("Bravo context is %" PRIlogctx ".\n", log_bravo);
    4343
    4444        while (true) {
     
    5050                        log_msg(level, "Printing level %d (%s).",
    5151                            (int) level, log_level_str(level));
    52                         log_ctx_msg(ctx_alpha, level,
    53                             "Printing level %d (%s) in alpha context.",
     52                        log_log_msg(log_alpha, level,
     53                            "Printing level %d (%s) into alpha log.",
    5454                            (int) level, log_level_str(level));
    55                         log_ctx_msg(ctx_bravo, level,
    56                             "Printing level %d (%s) in bravo context.",
     55                        log_log_msg(log_bravo, level,
     56                            "Printing level %d (%s) into bravo log.",
    5757                            (int) level, log_level_str(level));
    5858                        async_usleep(1000 * 100);
  • uspace/lib/c/generic/io/log.c

    rebbc8a74 rd6ddeb7  
    8383}
    8484
    85 static int logger_message(async_sess_t *session, log_context_t ctx, log_level_t level, const char *message)
     85static int logger_message(async_sess_t *session, log_t ctx, log_level_t level, const char *message)
    8686{
    8787        async_exch_t *exchange = async_exchange_begin(session);
     
    176176 * This function always returns a valid context.
    177177 */
    178 log_context_t log_context_create(const char *name)
     178log_t log_create(const char *name)
    179179{
    180180        async_exch_t *exchange = async_exchange_begin(logger_session);
    181181        if (exchange == NULL)
    182                 return LOG_CONTEXT_DEFAULT;
     182                return LOG_DEFAULT;
    183183
    184184        ipc_call_t answer;
     
    191191
    192192        if ((rc != EOK) || (reg_msg_rc != EOK))
    193                 return LOG_CONTEXT_DEFAULT;
     193                return LOG_DEFAULT;
    194194
    195195        return IPC_GET_ARG1(answer);
     
    203203 * @param fmt           Format string (no traling newline).
    204204 */
    205 void log_ctx_msg(log_context_t ctx, log_level_t level, const char *fmt, ...)
     205void log_log_msg(log_t ctx, log_level_t level, const char *fmt, ...)
    206206{
    207207        va_list args;
    208208
    209209        va_start(args, fmt);
    210         log_ctx_msgv(ctx, level, fmt, args);
     210        log_log_msgv(ctx, level, fmt, args);
    211211        va_end(args);
    212212}
     
    219219 * @param fmt           Format string (no trailing newline)
    220220 */
    221 void log_ctx_msgv(log_context_t ctx, log_level_t level, const char *fmt, va_list args)
     221void log_log_msgv(log_t ctx, log_level_t level, const char *fmt, va_list args)
    222222{
    223223        assert(level < LVL_LIMIT);
  • uspace/lib/c/include/io/log.h

    rebbc8a74 rd6ddeb7  
    5151} log_level_t;
    5252
    53 typedef sysarg_t log_context_t;
     53typedef sysarg_t log_t;
    5454#define PRIlogctx PRIxn
    55 #define LOG_CONTEXT_DEFAULT 0
     55#define LOG_DEFAULT 0
    5656
    5757extern const char *log_level_str(log_level_t);
     
    6060extern int log_init(const char *, log_level_t);
    6161
    62 extern log_context_t log_context_create(const char *);
     62extern log_t log_create(const char *);
    6363
    6464#define log_msg(level, format, ...) \
    65         log_ctx_msg(LOG_CONTEXT_DEFAULT, (level), (format), ##__VA_ARGS__)
     65        log_log_msg(LOG_DEFAULT, (level), (format), ##__VA_ARGS__)
    6666#define log_msgv(level, format, args) \
    67         log_ctx_msgv(LOG_CONTEXT_DEFAULT, (level), (format), (args))
     67        log_log_msgv(LOG_DEFAULT, (level), (format), (args))
    6868
    69 extern void log_ctx_msg(log_context_t, log_level_t, const char *, ...);
    70 extern void log_ctx_msgv(log_context_t, log_level_t, const char *, va_list);
     69extern void log_log_msg(log_t, log_level_t, const char *, ...);
     70extern void log_log_msgv(log_t, log_level_t, const char *, va_list);
    7171
    7272#endif
Note: See TracChangeset for help on using the changeset viewer.