Changeset e0c836e8 in mainline for uspace/lib/c/generic/io/log.c


Ignore:
Timestamp:
2012-09-07T08:29:43Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
42bde6a
Parents:
70253688
Message:

Add comments to logging interface in libc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/log.c

    r70253688 re0c836e8  
    4343#include <ns.h>
    4444
     45/** Id of the first log we create at logger. */
    4546static sysarg_t default_log_id;
    4647
     
    4849static const char *log_prog_name;
    4950
     51/** Names of individual log levels. */
    5052static const char *log_level_names[] = {
    5153        "fatal",
     
    6466#define MESSAGE_BUFFER_SIZE 4096
    6567
     68/** Send formatted message to the logger service.
     69 *
     70 * @param session Initialized IPC session with the logger.
     71 * @param log Log to use.
     72 * @param level Verbosity level of the message.
     73 * @param message The actual message.
     74 * @return Error code of the conversion or EOK on success.
     75 */
    6676static int logger_message(async_sess_t *session, log_t log, log_level_t level, char *message)
    6777{
     
    98108}
    99109
     110/** Get name of the log level.
     111 *
     112 * @param level The log level.
     113 * @return String name or "unknown".
     114 */
    100115const char *log_level_str(log_level_t level)
    101116{
     
    106121}
    107122
     123/** Convert log level name to the enum.
     124 *
     125 * @param[in] name Log level name or log level number.
     126 * @param[out] level_out Where to store the result (set to NULL to ignore).
     127 * @return Error code of the conversion or EOK on success.
     128 */
    108129int log_level_from_str(const char *name, log_level_t *level_out)
    109130{
     
    137158/** Initialize the logging system.
    138159 *
    139  * @param prog_name     Program name, will be printed as part of message
     160 * @param prog_name Program name, will be printed as part of message
    140161 */
    141162int log_init(const char *prog_name)
     
    190211/** Write an entry to the log.
    191212 *
    192  * @param level         Message verbosity level. Message is only printed
    193  *                      if verbosity is less than or equal to current
    194  *                      reporting level.
    195  * @param fmt           Format string (no traling newline).
     213 * The message is printed only if the verbosity level is less than or
     214 * equal to currently set reporting level of the log.
     215 *
     216 * @param ctx Log to use (use LOG_DEFAULT if you have no idea what it means).
     217 * @param level Severity level of the message.
     218 * @param fmt Format string in printf-like format (without trailing newline).
    196219 */
    197220void log_msg(log_t ctx, log_level_t level, const char *fmt, ...)
     
    206229/** Write an entry to the log (va_list variant).
    207230 *
    208  * @param level         Message verbosity level. Message is only printed
    209  *                      if verbosity is less than or equal to current
    210  *                      reporting level.
    211  * @param fmt           Format string (no trailing newline)
     231 * @param ctx Log to use (use LOG_DEFAULT if you have no idea what it means).
     232 * @param level Severity level of the message.
     233 * @param fmt Format string in printf-like format (without trailing newline).
     234 * @param args Arguments.
    212235 */
    213236void log_msgv(log_t ctx, log_level_t level, const char *fmt, va_list args)
Note: See TracChangeset for help on using the changeset viewer.