Changeset 6028ec8 in mainline for uspace/lib/usb/include/usb/debug.h


Ignore:
Timestamp:
2011-02-01T11:28:09Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0b31409
Parents:
632ed68
Message:

Add generic logging functions

See ticket #52.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/debug.h

    r632ed68 r6028ec8  
    11/*
    2  * Copyright (c) 2010 Vojtech Horky
     2 * Copyright (c) 2010-2011 Vojtech Horky
    33 * All rights reserved.
    44 *
     
    3737#include <stdio.h>
    3838#include <usb/usb.h>
     39#include <assert.h>
    3940
    4041void usb_dprintf(const char *tag, int level, const char *format, ...);
     
    4445    const uint8_t *, size_t);
    4546
     47/** Logging level. */
     48typedef enum {
     49    USB_LOG_LEVEL_FATAL,
     50    USB_LOG_LEVEL_ERROR,
     51    USB_LOG_LEVEL_WARNING,
     52    USB_LOG_LEVEL_INFO,
     53    USB_LOG_LEVEL_DEBUG,
     54    USB_LOG_LEVEL_DEBUG2
     55} usb_log_level_t;
     56
     57
     58void usb_log_enable(usb_log_level_t, const char *);
     59
     60void usb_log_printf(usb_log_level_t, const char *, ...);
     61
     62#define usb_log_fatal(format, ...) \
     63        usb_log_printf(USB_LOG_LEVEL_FATAL, format, ##__VA_ARGS__)
     64
     65#define usb_log_error(format, ...) \
     66        usb_log_printf(USB_LOG_LEVEL_ERROR, format, ##__VA_ARGS__)
     67
     68#define usb_log_warning(format, ...) \
     69        usb_log_printf(USB_LOG_LEVEL_WARNING, format, ##__VA_ARGS__)
     70
     71#define usb_log_info(format, ...) \
     72        usb_log_printf(USB_LOG_LEVEL_INFO, format, ##__VA_ARGS__)
     73
     74#define usb_log_debug(format, ...) \
     75        usb_log_printf(USB_LOG_LEVEL_DEBUG, format, ##__VA_ARGS__)
     76
     77#define usb_log_debug2(format, ...) \
     78        usb_log_printf(USB_LOG_LEVEL_DEBUG2, format, ##__VA_ARGS__)
     79
     80
     81
    4682#endif
    4783/**
Note: See TracChangeset for help on using the changeset viewer.