[4.0] Documentation 93/100293/16
authorMichal Bloch <m.bloch@samsung.com>
Tue, 15 Nov 2016 11:31:10 +0000 (12:31 +0100)
committerMichal Bloch <m.bloch@samsung.com>
Thu, 16 Mar 2017 13:52:08 +0000 (14:52 +0100)
 * fix errors
 * add grouping
 * add a rudimentary main page
 * autogenerate

Change-Id: I45988efcbb9aa12e0ed26dc7b3d2fe9b9a7eba6d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
23 files changed:
.gitignore
Doxyfile [new file with mode: 0644]
Makefile.am
doc/dlog_doc.h
doc/mainpage.dox [new file with mode: 0644]
include/dlog-internal.h
include/dlog.h
packaging/dlog.spec
src/libdlog/log.c
src/libdlog/log_android.c
src/libdlog/log_kmsg.c
src/libdlog/log_pipe.c
src/logctrl/logctrl.c
src/logctrl/logctrl_doc.h
src/logger/logger.c
src/loginit/loginit.c
src/logutil/logutil.c
src/logutil/logutil_doc.h
src/shared/log_file.c
src/shared/logcommon.c
src/shared/logconfig.c
src/shared/logprint.c
src/shared/queued_entry.c

index 8aee210..2724e45 100644 (file)
@@ -8,6 +8,7 @@ opt
 *.exe
 packages
 binaries
+documentation/
 *.ipk
 *~
 .deps/
diff --git a/Doxyfile b/Doxyfile
new file mode 100644 (file)
index 0000000..d7e6b97
--- /dev/null
+++ b/Doxyfile
@@ -0,0 +1,24 @@
+# Crucial stuff
+PROJECT_NAME           = "dlog"
+PROJECT_BRIEF          = "Logging framework"
+OUTPUT_DIRECTORY       = "documentation"
+INPUT                  = doc/ src/shared src/logutil src/logger src/loginit src/libdlog src/logctrl include/
+RECURSIVE              = YES
+
+# Misc optimisation
+OPTIMIZE_OUTPUT_FOR_C  = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS  = NO
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION    = NO
+REPEAT_BRIEF           = NO
+SEARCHENGINE           = YES
+GENERATE_LATEX         = NO # 2kinky4me
+CASE_SENSE_NAMES       = NO
+ENUM_VALUES_PER_LINE   = 1
+HAVE_DOT               = NO
+QUIET                  = YES
+
index 7db1dcb..59a4653 100644 (file)
@@ -132,3 +132,8 @@ usrlibtmpfilesd_DATA = configs/dlog-run.conf
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = dlog.pc
+
+dox::
+       doxygen
+
+.PHONY: dox
index ae5dc57..b957afc 100644 (file)
 #define __TIZEN_SYSTEM_DLOG_DOC_H__
 
 /**
- * @defgroup CAPI_SYSTEM_DLOG dlog
+ * @defgroup DLOG_IMPLEMENTATION DLog internal implementation
+ * @brief The internals of DLog
+ * @details This group collects the infernal implementation of the various programs the DLog framework consists of.
+ *
+ * @defgroup SHARED_FUNCTIONS Shared functions
+ * @ingroup DLOG_IMPLEMENTATION
+ * @brief Miscellaneous functions
+ * @details A loose collection of functions used across multiple DLog programs.
+ */
+
+/**
+ * @defgroup DLOG_COMMAND_LINE_UTILITIES DLog command line utilities
+ * @brief Interface utilities for the framework
+ * @details A collection of utilities for communicating with the framework so as to manipulate it.
+ */
+
+/**
+ * @defgroup CAPI_SYSTEM_DLOG DLog Public CAPI
  * @brief The Dlog API provides functions for sending log output.
  * @ingroup CAPI_SYSTEM_FRAMEWORK
  * @section CAPI_SYSTEM_DLOG_HEADER Required Header
@@ -75,78 +92,47 @@ Thus, developers can use appropriate method as a matter of convenience.
        } while (0); })
 @endcode
 
-<h1 class="pg">dlogutil</h1>
-<h2 class="pg">Introduction</h2>
-You can use dlogutil command to view and follow the contents of the log buffers. The general usage is :
-@code
-dlogutil [<option>] ... [<filter-spec>] ...
-@endcode
-
-<h2 class="pg">Filtering log output</h2>
-Every log message has a <I>tag</I> and a <I>priority</I> associated with it.
-Filter expression follows this format <B><I>tag:priority</I></B> where <I>tag</I> indicates the tag of interest and <I>priority</I> indicates the minimum level of priority to report for that tag. You can add any number of tag:priority specifications in a single filter expression.
-The tag of a log message is a short indicating the system component from which the message originates
-The <I>priority</I> is one of the following character values, orderd from lowest to highest priority:<br>
-D - debug<br>
-I - info<br>
-W - warning<br>
-E - Error<br>
-
-for example, if you want to see MY_APP tag and above of debug priority,
-@code
-# dlogutil MY_APP:D
-@endcode
-if you want to see all log message above of info priority.
-@code
-# dlogutil *:I
-@endcode
-
-<h2 class="pg">List of logutil command options</h2>
-
-<table>
-<tr>
-       <th>Option</th>
-       <th>Description</th>
-</tr>
-<tr>
-       <td>-b \<buffer\> </td>
-       <td>Alternate log buffer. The main buffer is used by default buffer. </td>
-</tr>
-<tr>
-       <td>-c</td>
-       <td>Clears the entire log and exits</td>
-</tr>
-<tr>
-       <td>-d</td>
-       <td>Dumps the log and exits.</td>
-</tr>
-<tr>
-       <td>-f \<filename\></td>
-       <td>Writes log to filename. The default is stdout</td>
-</tr>
-<tr>
-       <td>-g</td>
-       <td>Print the size of the specified log buffer and exits.</td>
-</tr>
-<tr>
-       <td>-n \<count\></td>
-       <td>Sets the maximum number of rotated logs to count. The default value is 4. Requires the -r option</td>
-</tr>
-<tr>
-       <td>-r \<Kbytes\></td>
-       <td>Rotates the log file every Kbytes of output. The default value is 16. Requires the -f option.</td>
-</tr>
-<tr>
-       <td>-s</td>
-       <td>Sets the default filter spec to silent.</td>
-</tr>
-<tr>
-       <td>-v \<format\></td>
-       <td>Sets the output format for log messages. The default is brief format. </td>
-</tr>
-
-</table>
->>>>>>> mobile
 *
 **/
+
+/**
+ * @addtogroup DLOG_COMMAND_LINE_UTILITIES
+ *
+ * Most CLI allow you to specify buffers. These are:
+ *
+ * name   | remarks
+ * -------|---------
+ * main   | the default, for general platform logging
+ * system | for system logs
+ * radio  | for radio logs
+ * apps   | for applications
+ * kmsg   | a copy of kernel messages (dmesg)
+ *
+ * There are also priorities to be specified. These are one letter abbreviations of the following levels:
+ *
+ * Abbr | Level
+ * -----|-------
+ *    V | verbose
+ *    D | debug
+ *    I | info
+ *    W | warning
+ *    E | error
+ *    F | fatal
+ *    S | silent
+ *
+ * Formats, and what they look like:
+ *
+ * name       | specification                            | example
+ * -----------|------------------------------------------|-------------
+ * brief      | PRI/TAG(PID): MSG                        | E/TEST_APP(123): FOO
+ * process    | PRI(PID) MSG (TAG)                       | E(123) FOO (TEST_APP)
+ * tag        | PRI/TAG: MSG                             | E/TEST_APP: FOO
+ * thread     | PRI('P'PID, 'T'TID) MSG                  | E(P123, T456) FOO
+ * raw        | MSG                                      | FOO
+ * time       | REALTIME PRI/TAG(PID): MSG               | 12-31 23:59:59.999 +0200 E/TEST_APP(123): FOO
+ * threadtime | REALTIME PRI/TAG('P'PID, 'T'TID): MSG    | 12-31 23:59:59.999 +0200 E/TEST_APP(P123, T456): FOO
+ * kerneltime | BOOTTIME PRI/TAG('P'PID, 'T'TID): MSG    | 0.123 E/TEST_APP(P123, T456): FOO
+ * long       | [REALTIME PRI/TAG 'P'PID, 'T'TID]<br>MSG<br> | [12-31 23:59:59.999 +0200 E/TEST_APP P123, T456]<br>FOO<br>
+ */
+
 #endif /* __TIZEN_SYSTEM_DLOG_DOC_H__ */
diff --git a/doc/mainpage.dox b/doc/mainpage.dox
new file mode 100644 (file)
index 0000000..4727810
--- /dev/null
@@ -0,0 +1,19 @@
+/** @mainpage Logging framework
+
+DLog is a logging framework. It allows applications to create log messages for later retrieval.
+
+Each log has a priority level and a tag for easier access. When reading logs, one can filter by these two values.
+
+Applications using the public API can only write to a common application buffer. Platform code also has access to three additional buffers: main, radio and system.
+
+Under the hood, dlog can use one of multiple back-ends. The CAPI stays the same for each backend but there might be slight differences when retrieving the logs.
+
+DLog had been introduced gradually and its earliest availability varies by profile:
+
+Profile  | Version
+---------|----------
+Mobile   | 2.3
+Wearable | 2.3.1
+TV       | 3.0
+
+*/
index a917e2e..245f5af 100644 (file)
@@ -48,7 +48,6 @@ extern "C" {
 /**
  * @internal
  * @brief log id
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @elseif TV 3.0 @endif
  */
 typedef enum {
        LOG_ID_INVALID = -1,
index 22f014e..ae45152 100644 (file)
@@ -57,7 +57,6 @@ extern "C" {
 
 /**
  * @brief Enumeration for Dlog Error.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @elseif TV 3.0 @endif
  */
 typedef enum {
        DLOG_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
@@ -79,7 +78,6 @@ typedef enum {
 
 /**
  * @brief Enumeration for log priority values in ascending priority order.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @elseif TV 3.0 @endif
  */
 typedef enum {
        DLOG_UNKNOWN = 0, /**< Keep this always at the start */
@@ -109,10 +107,9 @@ typedef enum {
 /**
  * @brief Sends log with priority and tag.
  * @details for application.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @elseif TV 3.0 @endif
- * @param[in] prio log_priority
- * @param[in] tag Tag
- * @param[in] fmt Format string
+ * @param[in] prio priority level of type #log_priority
+ * @param[in] tag tag - a null-terminated string
+ * @param[in] fmt format string - same as printf
  * @return On success, the function returns the number of bytes written.
  *         On error, a negative errno-style error code
  * @retval #DLOG_ERROR_INVALID_PARAMETER Invalid parameter
@@ -140,10 +137,9 @@ int dlog_print(log_priority prio, const char *tag, const char *fmt, ...);
 /**
  * @brief Sends log with priority, tag, and va_list.
  * @details for application.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @elseif TV 3.0 @endif
- * @param[in] prio log_priority
- * @param[in] tag Tag
- * @param[in] fmt Format string
+ * @param[in] prio priority level of type #log_priority
+ * @param[in] tag tag - a null-terminated string
+ * @param[in] fmt format string - same as printf
  * @param[in] ap va_list
  * @return On success, the function returns the number of bytes written.
  *         On error, a negative errno-style error code
index 7c18849..08a84dc 100644 (file)
@@ -77,6 +77,12 @@ Requires(preun): /usr/bin/systemctl
 %description -n dlogutil
 Utilities for print log data
 
+%package -n dlog-doc
+Summary: Dox
+BuildRequires: doxygen
+
+%description -n dlog-doc
+Documentation for dlog
 
 %prep
 %setup -q
@@ -95,12 +101,18 @@ make %{?jobs:-j%jobs} \
 
 make check
 
+make dox
+
 %install
 rm -rf %{buildroot}
 
 %make_install
 mkdir -p %{buildroot}/usr/bin/
 
+
+mkdir -p %{buildroot}/usr/share/doc/dlog
+cp -r documentation/* %{buildroot}/usr/share/doc/dlog
+
 mkdir -p %{buildroot}%{TZ_SYS_ETC}
 install -m 0644 configs/dlog.conf.pipe %{buildroot}%{TZ_SYS_ETC}/dlog.conf.pipe
 install -m 0644 configs/dlog.conf.kmsg %{buildroot}%{TZ_SYS_ETC}/dlog.conf.kmsg
@@ -224,3 +236,6 @@ ln %{upgrade_file_path}/data/dlog.conf.pipe %{upgrade_file_path}/data/dlog.conf
 %attr(664,log,log) %{TZ_SYS_ETC}/dlog.conf.logger
 # For upgrade
 %{upgrade_file_path}/data/dlog.conf.logger
+
+%files -n dlog-doc
+/usr/share/doc/dlog
index 68c9de1..b21eba7 100644 (file)
@@ -51,7 +51,7 @@ static int fatal_assert;
 
 /**
  * @brief Null handler
- * @description Ignores a log
+ * @details Ignores a log
  * @param[in] log_id ID of the buffer to log to. Belongs to (LOG_ID_INVALID, LOG_ID_MAX) non-inclusive
  * @param[in] prio Priority of the message.
  * @param[in] tag The message tag, identifies the sender.
@@ -286,15 +286,6 @@ int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ..
        return ret;
 }
 
-/**
- * @brief Print log
- * @details Print a log line
- * @param[in] prio Priority
- * @param[in] tag tag
- * @param[in] fmt Format (same as printf)
- * @param[in] ap Argument list
- * @return Bytes written, or negative error
- */
 int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap)
 {
        char buf[LOG_MAX_SIZE];
@@ -307,14 +298,6 @@ int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap)
        return write_to_log(LOG_ID_APPS, prio, tag, buf);
 }
 
-/**
- * @brief Print log
- * @details Print a log line
- * @param[in] prio Priority
- * @param[in] tag tag
- * @param[in] fmt Format (same as printf)
- * @return Bytes written, or negative error
- */
 int dlog_print(log_priority prio, const char *tag, const char *fmt, ...)
 {
        va_list ap;
index 57a75fb..d510e21 100644 (file)
@@ -12,7 +12,7 @@ static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1, -1 };
 
 /**
  * @brief Write to log
- * @description Writes a log
+ * @details Writes a log
  * @param[in] log_id ID of the buffer to log to. Belongs to (LOG_ID_INVALID, LOG_ID_MAX) non-inclusive
  * @param[in] prio Priority of the message.
  * @param[in] tag The message tag, identifies the sender.
@@ -55,7 +55,7 @@ static int __write_to_log_android(log_id_t log_id, log_priority prio, const char
 
 /**
  * @brief Initialize the backend
- * @description Prepares the backend for proper and fruitful work
+ * @details Prepares the backend for proper and fruitful work
  */
 void __dlog_init_android()
 {
index d6235ef..66bca55 100644 (file)
@@ -11,7 +11,7 @@ static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1, -1 };
 
 /**
  * @brief Write to log
- * @description Writes a log
+ * @details Writes a log
  * @param[in] log_id ID of the buffer to log to. Belongs to (LOG_ID_INVALID, LOG_ID_MAX) non-inclusive
  * @param[in] prio Priority of the message.
  * @param[in] tag The message tag, identifies the sender.
@@ -62,7 +62,7 @@ static int __write_to_log_kmsg(log_id_t log_id, log_priority prio, const char *t
 
 /**
  * @brief Initialize the backend
- * @description Prepares the backend for proper and fruitful work
+ * @details Prepares the backend for proper and fruitful work
  */
 void __dlog_init_kmsg()
 {
index 6935a81..0dbb721 100644 (file)
@@ -98,7 +98,7 @@ static int __reconnect_pipe(log_id_t log_id)
 
 /**
  * @brief Write to log
- * @description Writes a log
+ * @details Writes a log
  * @param[in] log_id ID of the buffer to log to. Belongs to (LOG_ID_INVALID, LOG_ID_MAX) non-inclusive
  * @param[in] prio Priority of the message.
  * @param[in] tag The message tag, identifies the sender.
@@ -149,7 +149,7 @@ static int __write_to_log_pipe(log_id_t log_id, log_priority prio, const char *t
 
 /**
  * @brief Initialize the backend
- * @description Prepares the backend for proper and fruitful work
+ * @details Prepares the backend for proper and fruitful work
  */
 void __dlog_init_pipe()
 {
index 2fb29df..1f52c7c 100644 (file)
@@ -6,6 +6,15 @@
 #include <logconfig.h>
 #include "logctrl_doc.h"
 
+/**
+ * @addtogroup DLOG_IMPLEMENTATION
+ * @{
+ * @defgroup DLOG_CTRL Control
+ * @brief The config controller
+ * @details The controller responsible for manipulation of the configuration.
+ * @{
+ */
+
 struct options {
        int print_all;
        int has_key;
@@ -167,3 +176,8 @@ cleanup:
        log_config_free(&conf_etc);
        return 1;
 }
+
+/**
+ * @}
+ * @}
+ */
index a152faa..8ef5ddc 100644 (file)
@@ -1,8 +1,47 @@
+/**
+ @defgroup CLI_DLOGCTRL dlogctrl usage
+ @ingroup DLOG_COMMAND_LINE_UTILITIES
+ @brief Configuration manipulation application
+ @details dlogctrl is an application that helps configure the logging framework.
+
+The program accepts the following arguments:
+
+Argument | Requirements                              | Meaning
+---------|-------------------------------------------|-------------
+-p       | conflicts with -ki                        | Print all config values.
+-i       | conflicts with -pk                        | Show extended information.
+-k key   | conflicts with -ip, requires one of -gsc  | Choose a key for -gsc
+-c       | conflicts with -gs, requires -k           | Clear the value associated with the key
+-g       | conflicts with -sc, requires -k           | Print the value associated with the key
+-s value | conflicts with -gc, requires - k          | Set the value associated with the key
+
+Important config entries:
+
+Key     | Value | Meaning
+--------|-------|----
+plog | 0 or 1 | Enable platform logging. Else, only app logs are collected.
+limiter | 0 or 1 | Enable log limiting. See limiter rules for details.
+limiter\|\<TAG\>\|\<PRIORITY\> | "allow", "deny" or integers | A series of entries to control limiting of apps with given TAG and PRIORITY. "allow" and values < 0 mean no filtering, "deny" or values > 10000 mean no logging allowed, and values between 0 and 10000 mean this many logs per minute are allowed.
+util_sorting_time_window | >= 0 | Sorting time window (in ms) for dlogutil. dlogutil can achieve logs out of order so it waits a bit to make sure unsorted logs have had time to arrive and get sorted.
+dlog_logger_conf_# | dlogutil invocations | The keys should be consecutive numbers from 0. The logger daemon will behave as if dlogutil was invoked for each of these.
+\<BUFFER\> | path | Specifies the path to given buffer. Only for android-logger and kmsg backends. Do not change because these are usually hardcoded in the kernel.
+\<BUFFER\>_{ctl,write}_sock | path | Pipe backend only. Specifies a path to the control/write socket for given buffer.
+\<BUFFER\>_{ctl,write}_sock_owner | username | Pipe backend only. Specifies the owner of the control/write socket for given buffer.
+\<BUFFER\>_{ctl,write}_sock_group | path | Pipe only. Specifies the group of the control/write socket for given buffer.
+\<BUFFER\>_{ctl,write}_sock_rights | file permissions | Pipe backend only. Specifies file permissions of the control/write socket for given buffer (in the usual octal format).
+\<BUFFER\>_size | > 0 | Size of given buffer
+debugmode | 0 or 1 | If 0, logs of DEBUG priority are dropped
+util_sorting_buffer_size | > 0 | How large of a buffer dlogutil keeps for sorting.
+
+*/
+
+
+
 void print_help()
 {
        printf("dlogctrl - provides control over dlog configuration. Options:\n"
-               "\t-p        Precludes -kh. Prints all entries in the config.\n"
-               "\t-k key    Precludes -ph and requires one of -gs.  Specifies a config key.\n"
+               "\t-p        Precludes -ki. Prints all entries in the config.\n"
+               "\t-k key    Precludes -pi and requires one of -gs.  Specifies a config key.\n"
                "\t-g        Requires -k, precludes -cs. Gets and prints the value of the entry assigned to the key.\n"
                "\t-s value  Requires -k, precludes -cg. Sets the value of the entry associated with the key.\n"
                "\t-c        Requires -k, precludes -gs. Clears the entry.\n"
index fac219b..753651e 100644 (file)
 #include <logconfig.h>
 #include <systemd/sd-daemon.h>
 
+/**
+ * @addtogroup DLOG_IMPLEMENTATION
+ * @{
+ * @defgroup DLOG_LOGGER Logger
+ * @brief Logger daemon
+ * @details The logger is the core component of the logging framework. It is responsible for collecting, processing and exposing logs.
+ * @{
+ */
+
 /* supported main() return codes */
 enum {
        DLOG_EXIT_SUCCESS = 0,
@@ -260,7 +269,7 @@ static int parse_permissions(const char * str)
 
 /**
  * @brief Get numerical ids for specified user and group
- * @detail Converts user and group strings to proper uid and gid identifiers
+ * @details Converts user and group strings to proper uid and gid identifiers
  * @param[in] user The new user
  * @param[in] group The new group
  * @param[out] uid The uid for user
@@ -301,7 +310,7 @@ static int usergr2id(const char * user, const char * group, uid_t *uid, gid_t *g
 
 /**
  * @brief Change file owners
- * @detail Changes user and group ownership of a file
+ * @details Changes user and group ownership of a file
  * @param[in] file Filename of the file to change
  * @param[in] user The new user
  * @param[in] group The new group
@@ -824,7 +833,7 @@ cleanup_ret:
  * @param[in] socket The FD of the socket
  * @param[in] wr_pipe The pipe to send over the socket
  * @param[in] type The type of the pipe (DLOG_FLAG_READ or DLOG_FLAG_WRITE)
- * @return 0 on success, else negative error
+ * @return 0 on success, else -errno
  */
 static int send_pipe(int socket, int wr_pipe, int type)
 {
@@ -858,7 +867,7 @@ static int send_pipe(int socket, int wr_pipe, int type)
 
 /**
  * @brief Writer close FD
- * @description Close a writer's connections
+ * @details Close a writer's connections
  * @param[in] server The logger server
  * @param[in] wr The writer whose connections to close
  */
@@ -1252,7 +1261,7 @@ static void fd_change_flag(int fd, int flag, int set)
 
 /**
  * @brief Service util request
- * @description Handle a request from util
+ * @details Handle a request from util
  * @param[in] server The logger server
  * @param[in] wr The writer who sent the request
  * @param[in] msg The message containing the request
@@ -1289,7 +1298,7 @@ static int service_writer_handle_req_util(struct logger* server, struct writer*
 
 /**
  * @brief Service clear request
- * @description Handle a clear-buffer request
+ * @details Handle a clear-buffer request
  * @param[in] server The logger server
  * @param[in] wr The writer who sent the request
  * @param[in] msg The message containing the request
@@ -1323,7 +1332,7 @@ static int service_writer_handle_req_clear(struct logger* server, struct writer*
 
 /**
  * @brief Service a pipe acquisition request
- * @description Handle a pipe request
+ * @details Handle a pipe request
  * @param[in] server The logger server
  * @param[in] wr The writer who sent the request
  * @param[in] msg The message containing the request
@@ -1367,7 +1376,7 @@ err_close:
 
 /**
  * @brief Service a socket request
- * @description Handle a socket request
+ * @details Handle a socket request
  * @param[in] server The logger server
  * @param[in] wr The writer who sent the request
  * @param[in] event The event containing the request
@@ -1426,7 +1435,7 @@ static int service_writer_socket(struct logger* server, struct writer* wr, struc
 
 /**
  * @brief Service pipe log data
- * @description Handle log messages incoming through a pipe
+ * @details Handle log messages incoming through a pipe
  * @param[in] server The logger server
  * @param[in] wr The writer who sent the logs
  * @param[in] event The event associated with the data
@@ -1463,11 +1472,11 @@ static int service_writer_pipe(struct logger* server, struct writer* wr, struct
 
 /**
  * @brief Service /dev/kmsg
- * @description Read from the /dev/kmsg device
+ * @details Read from the /dev/kmsg device
  * @param[in] server The logger server
  * @param[in] wr The writer who sent the request
  * @param[in] event The relevant event
- * @return 0 on success, else errno
+ * @return 0 on success, else -errno
  */
 static int service_writer_kmsg(struct logger* server, struct writer* wr, struct epoll_event* event)
 {
@@ -1496,7 +1505,7 @@ static int service_writer_kmsg(struct logger* server, struct writer* wr, struct
 
 /**
  * @brief Service a writer
- * @description Relegates the event to specific handlers
+ * @details Relegates the event to specific handlers
  * @param[in] server The logger server
  * @param[in] wr The writer who sent the request
  * @param[in] event The relevant event
@@ -2002,3 +2011,8 @@ cleanup:
        logger_free(&server);
        return ret;
 }
+
+/**
+ * @}
+ * @}
+ */
index e0ddb03..d1bee5b 100644 (file)
@@ -128,3 +128,19 @@ error:
        remove_kmsg_devs(kmsg_fd);
        exit(EXIT_FAILURE);
 }
+
+/**
+ @defgroup CLI_DLOGINIT dloginit usage
+ @ingroup DLOG_COMMAND_LINE_UTILITIES
+ @brief KMSG buffer creator
+ @details dloginit provides a way to create buffers in the KMSG backend. It works in three simple steps:
+
+ 1) read requested size values from the config
+
+ 2) create buffers
+
+ 3) write final size values and buffer paths back to the config
+
+It accepts no parameters. To read more about the config, see dlogctrl documentation.
+*/
+
index 87e51ae..21dde95 100644 (file)
 #include "logutil_doc.h"
 #include <dlog_ioctl.h>
 
+/**
+ * @addtogroup DLOG_IMPLEMENTATION
+ * @{
+ * @defgroup DLOG_UTIL Util
+ * @brief The log retrieval utility
+ * @details The utility responsible for reading and processing logs for the user.
+ * @{
+ */
+
 /* should fit a whole command line with concatenated arguments (reasonably) */
 #define MAX_LOGGER_REQUEST_LEN 127
 
@@ -156,7 +165,7 @@ static int connect_sock(const char * path)
 /**
  * @brief Clear request
  * @details Send a CLEAR request to the logger daemon
- * @param[in] The socket to send the request over
+ * @param[in] sock_fd The socket to send the request over
  * @return 1 on success, 0 on failure
  */
 static int do_clear_pipe(int sock_fd)
@@ -211,6 +220,8 @@ void clear_log_logger(int fd)
  * @brief Get buffer size
  * @details Print the size of the working buffer
  * @param[in] conf The configuration
+ * @param[in] names Buffers to process
+ * @param[in] cnt Buffer count
  * @return 0 on success, 1 on failure
  */
 static int do_getsize(struct log_config * conf, char ** names, int cnt)
@@ -235,7 +246,8 @@ static int do_getsize(struct log_config * conf, char ** names, int cnt)
  * @details Send a logging request to the daemon
  * @param[in] argc Argument count
  * @param[in] argv Argument values
- * @preturn 1 on success, 0 on failure
+ * @param[in] sock_fd Socket file descriptor
+ * @return 1 on success, 0 on failure
  */
 static int send_logger_request(int argc, char ** argv, int sock_fd)
 {
@@ -541,8 +553,8 @@ closefile:
 /**
  * @brief Filter buffer names
  * @details Purges invalid buffer names from the table
- * @param[in/out] names The buffer names
- * @param[in/out] cnt The table size
+ * @param[in,out] names The buffer names
+ * @param[in,out] cnt The table size
  */
 void filter_buffer_names(char ** names, int * cnt)
 {
@@ -933,3 +945,8 @@ numeric_optarg:
        printf("Error: -%c requires a numerical parameter\n", option);
        return 1;
 }
+
+/**
+ * @}
+ * @}
+ */
index c5ef302..98fcd97 100644 (file)
@@ -1,3 +1,40 @@
+/**
+ @defgroup CLI_DLOGUTIL dlogutil usage
+ @ingroup DLOG_COMMAND_LINE_UTILITIES
+ @brief Log reading utility
+ @details dlogutil is a utility that can be utilised to read stored logs.
+
+The most rudimentary way to use it is to run it with no parameters; it then prints all stored logs to the standard output and awaits more.
+
+Parameters exist to change this behaviour:
+
+Parameter       | Description
+----------------|---------------------------------
+-s              | Set default filter to *:s (see later for details)
+-f filename     | Output to given file instead of stdout
+-r kbytes       | Rotate log file every this many kilobytes.
+-n files        | Keep this many old rotations
+-v              | Set log output format.
+-b buffer       | Select another buffer
+-c              | Clear the selected buffers
+-d              | Exit when no more logs are currently available
+-t count        | Similar to -d, except only print this many logs from the end
+-g              | Get the size of selected buffers instead of printing logs
+-h, --help      | Show help info
+--dumpfile file | Parse a binary file generated by the logger daemon
+
+Additionally, you can specify filters. Filters go behind the parameters and are used to decide which logs are shown.
+
+Each log line has priority and a tag. Filters are specified in the format TAG[:PRIO]. Only logs with given tags and priorities are shown.
+
+You can specify * as the tag to match anything. Beware: only a single asterisk works that way, asterisk is not otherwise expanded. For example, "T*G" filter will NOT match "TAG", only literal "T*G".
+
+If you don't specify any filter, it defaults to *:I
+If you specify just * as the tag, without priority, its priority defaults to D
+If you specify any other tag without priority, the priority defaults to V
+
+*/
+
 static void show_help(const char *cmd)
 {
        fprintf(stderr,
index 538a2cb..af398be 100644 (file)
 #include <limits.h>
 
 /**
+ * @addtogroup SHARED_FUNCTIONS
+ * @{
+ */
+
+/**
  * @brief Open a log file
  * @details Open a log file into the passed structure.
- * @param[in] logfile The file structure to contain the opened file descriptor
+ * @param[in] file The file structure to contain the opened file descriptor
  * @remarks Creates the file if it does not exist, else appends to it.
  */
 void open_logfile(struct log_file *file)
@@ -47,7 +52,7 @@ void open_logfile(struct log_file *file)
 /**
  * @brief Rotate log files
  * @details Opens a new file and moves existing files further back
- * @param[in] logfile The file structure to contain the currently opened file
+ * @param[in] file The file structure to contain the currently opened file
  */
 void rotate_logs(struct log_file *file)
 {
@@ -69,3 +74,7 @@ void rotate_logs(struct log_file *file)
        open_logfile(file);
        file->size = 0;
 }
+
+/**
+ * @}
+ */
index 7bb9460..3fc4b05 100644 (file)
 #include <fcntl.h>
 #include <logcommon.h>
 
+/**
+ * @addtogroup SHARED_FUNCTIONS
+ * @{
+ */
+
 #define MAX_PREFIX_SIZE 32
 #define LINE_MAX        (MAX_PREFIX_SIZE+PATH_MAX)
 
@@ -93,7 +98,7 @@ void syslog_critical_failure(const char * message)
 /**
  * @brief Receive a file descriptor from a socket
  * @details Receives a message from given socket fd and retrieves another fd from inside
- * @param[in] sock_fd The socket's file descriptor
+ * @param[in] socket The socket's file descriptor
  * @return The file descriptor received from the socket, -errno on failure
  * @retval -EIO No descriptor was received from the socket
  */
@@ -141,3 +146,7 @@ int recv_file_descriptor(int socket)
        } else
                return -EIO;
 }
+
+/**
+ * @}
+ */
index fbec801..b907421 100644 (file)
@@ -5,6 +5,11 @@
 #include <errno.h>
 
 /**
+ * @addtogroup SHARED_FUNCTIONS
+ * @{
+ */
+
+/**
  * @brief A singular config entry list element.
  */
 struct log_conf_entry {
@@ -16,7 +21,7 @@ struct log_conf_entry {
 /**
  * @brief Get a config value
  * @details Returns a value with the given key from the given config
- * @param[in] config The config to work with
+ * @param[in] c The config to work with
  * @param[in] key The key of the value entry to get
  * @return The value of the entry if such exists, else NULL
  * @see log_config_set, log_config_push, log_config_remove
@@ -41,7 +46,7 @@ const char * log_config_get(struct log_config* c, const char* key)
 /**
  * @brief Set a config value
  * @details Sets the entry with the given key in the given config to the given value
- * @param[in] config The config to work with
+ * @param[in] c The config to work with
  * @param[in] key The key of the value entry to set
  * @param[in] value The value to set
  * @remarks The entry must already exist
@@ -167,6 +172,7 @@ void log_config_free(struct log_config* config)
  * @brief Save the config to a file
  * @details Saves the given config under the given filename
  * @param[in] config The config whose contents to save
+ * @param[in] filename The name of the file
  * @see log_config_read
  * @return 0 on success, -errno on failure
  */
@@ -262,8 +268,7 @@ void log_config_push(struct log_config* config, const char* key, const char* val
  * @brief Remove an entry
  * @details Remove the entry under the given key from the given config
  * @param[in] config The config to work with
- * @param[in] key The key of the entry to create
- * @param[in] value The value of the new entry
+ * @param[in] key The key of the entry to remove
  * @return 1 if the entry existed and was removed, else 0
  * @see log_config_set, log_config_get, log_config_push
  */
@@ -320,3 +325,7 @@ int log_config_foreach(struct log_config* config, configIter iter)
        }
        return r;
 }
+
+/**
+ * @}
+ */
index 79d29a9..44686b6 100644 (file)
 
 #include <logprint.h>
 
+/**
+ * @addtogroup SHARED_FUNCTIONS
+ * @{
+ */
+
 typedef struct FilterInfo_t {
        char *mTag;
        log_priority mPri;
@@ -257,7 +262,7 @@ void log_format_free(log_format *p_format)
 
 /**
  * @brief Set print format
- * @detail Sets a log format's print format
+ * @details Sets a log format's print format
  * @param[in] p_format The log format whose print format to set
  * @param[in] format The print format
  */
@@ -364,7 +369,7 @@ error:
  * @brief Add filter string
  * @details Adds multiple tag/priority filtering rule from a string
  * @param[in] p_format The log format to add the filter rules to
- * @param[in] filterstring A filter string containing multiple filter rules delimited by spaces, tabs or commas
+ * @param[in] filterString A filter string containing multiple filter rules delimited by spaces, tabs or commas
  * @return 0 on success, else -1
  * @remarks Assumes single threaded execution
  */
@@ -732,3 +737,7 @@ done:
 
        return ret;
 }
+
+/**
+ * @}
+ */
index 1c56c2c..2b8652c 100644 (file)
 #include <assert.h>
 
 /**
+ * @addtogroup SHARED_FUNCTIONS
+ * @{
+ */
+
+/**
  * @brief Create pipe message
  * @details Prepares a pipe message structure by filling its members appropriately
  * @param[out] buf The pointer to (the buffer containing) the struct
@@ -88,7 +93,7 @@ static char* parse_dict_val(char *buf, char **val)
 /**
  * @brief Parse KMSG message
  * @details Parses a raw KMSG message into the internal format
- * @param[in/out] buffer The buffer which contains the message and will contain the entry afterwards
+ * @param[in,out] buffer The buffer which contains the message and will contain the entry afterwards
  * @param[in] prime Whether this is the primary /dev/kmsg or an extra numbered device /dev/kmsg##
  * @param[in] buffer_size The size of the input buffer
  * @return 1 on success, 0 on failure.
@@ -240,3 +245,7 @@ void add_recv_timestamp(struct logger_entry * const le)
        le->sec_recv_real = ts.tv_sec;
        le->nsec_recv_real = ts.tv_nsec;
 }
+
+/**
+ * @}
+ */