Logging Dispatcher. More...
Go to the source code of this file.
Data Structures | |
| struct | LogLine |
| A Log line. More... | |
Macros | |
| #define | LOG_LINE_MAX_LEN 10240 |
| Log lines longer than this will be truncated. | |
| #define | mutt_debug(LEVEL, ...) |
| #define | mutt_warning(...) |
| #define | mutt_message(...) |
| #define | mutt_error(...) |
| #define | mutt_perror(...) |
| #define | log_multiline(LEVEL, STRING) |
Typedefs | |
| typedef int(* | log_dispatcher_t) (time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__ |
| typedef int log_dispatcher_t | MuttLogger |
Enumerations | |
| enum | LogLevel { LL_PERROR = -3 , LL_ERROR = -2 , LL_WARNING = -1 , LL_MESSAGE = 0 , LL_DEBUG1 = 1 , LL_DEBUG2 = 2 , LL_DEBUG3 = 3 , LL_DEBUG4 = 4 , LL_DEBUG5 = 5 , LL_NOTIFY = 6 , LL_MAX } |
| Names for the Logging Levels. More... | |
Functions | |
| STAILQ_HEAD (LogLineList, LogLine) | |
| void | log_multiline_full (enum LogLevel level, const char *str, const char *file, int line, const char *func) |
| Helper to dump multiline text to the log. | |
| int | log_disp_file (time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__ |
| int int | log_disp_null (time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__ |
| int int int | log_disp_queue (time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__ |
| int int int int | log_disp_terminal (time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__ |
| int int int int int | log_queue_add (struct LogLine *ll) |
| Add a LogLine to the queue. | |
| void | log_queue_empty (void) |
| Free the contents of the queue. | |
| void | log_queue_flush (log_dispatcher_t disp) |
| Replay the log queue. | |
| struct LogLineList | log_queue_get (void) |
| Get the Log Queue. | |
| void | log_queue_set_max_size (int size) |
| Set a upper limit for the queue length. | |
| void | log_file_close (bool verbose) |
| Close the log file. | |
| int | log_file_open (bool verbose) |
| Start logging to a file. | |
| bool | log_file_running (void) |
| Is the log file running? | |
| int | log_file_set_filename (const char *file, bool verbose) |
| Set the filename for the log. | |
| int | log_file_set_level (enum LogLevel level, bool verbose) |
| Set the logging level. | |
| void | log_file_set_version (const char *version) |
| Set the program's version number. | |
Variables | |
| const char * | LogLevelAbbr |
| Abbreviations of logging level names. | |
Logging Dispatcher.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file logging2.h.
| #define LOG_LINE_MAX_LEN 10240 |
Log lines longer than this will be truncated.
Definition at line 32 of file logging2.h.
| #define log_multiline | ( | LEVEL, | |
| STRING ) |
Definition at line 98 of file logging2.h.
| typedef int(* log_dispatcher_t) (time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__ |
Definition at line 71 of file logging2.h.
|
extern |
| enum LogLevel |
Names for the Logging Levels.
Definition at line 39 of file logging2.h.
| STAILQ_HEAD | ( | LogLineList | , |
| LogLine | ) |
| void log_multiline_full | ( | enum LogLevel | level, |
| const char * | str, | ||
| const char * | file, | ||
| int | line, | ||
| const char * | func ) |
Helper to dump multiline text to the log.
| level | Logging level, e.g. LL_DEBUG1 |
| str | Text to save |
| file | Source file |
| line | Source line number |
| func | Source function |
Definition at line 488 of file logging.c.
| int log_disp_file | ( | time_t | stamp, |
| const char * | file, | ||
| int | line, | ||
| const char * | function, | ||
| enum LogLevel | level, | ||
| const char * | format, | ||
| ... ) |
| int int log_disp_null | ( | time_t | stamp, |
| const char * | file, | ||
| int | line, | ||
| const char * | function, | ||
| enum LogLevel | level, | ||
| const char * | format, | ||
| ... ) |
| int int int log_disp_queue | ( | time_t | stamp, |
| const char * | file, | ||
| int | line, | ||
| const char * | function, | ||
| enum LogLevel | level, | ||
| const char * | format, | ||
| ... ) |
| int int int int log_disp_terminal | ( | time_t | stamp, |
| const char * | file, | ||
| int | line, | ||
| const char * | function, | ||
| enum LogLevel | level, | ||
| const char * | format, | ||
| ... ) |
| int int int int int log_queue_add | ( | struct LogLine * | ll | ) |
Add a LogLine to the queue.
| ll | LogLine to add |
| num | Entries in the queue |
If LogQueueMax is non-zero, the queue will be limited to this many items.
Definition at line 292 of file logging.c.
| void log_queue_empty | ( | void | ) |
Free the contents of the queue.
Free any log lines in the queue.
Definition at line 331 of file logging.c.
| void log_queue_flush | ( | log_dispatcher_t | disp | ) |
Replay the log queue.
| disp | Log dispatcher - Implements log_dispatcher_t |
Pass all of the log entries in the queue to the log dispatcher provided. The queue will be emptied afterwards.
Definition at line 353 of file logging.c.
| struct LogLineList log_queue_get | ( | void | ) |
| void log_queue_set_max_size | ( | int | size | ) |
| void log_file_close | ( | bool | verbose | ) |
Close the log file.
| verbose | If true, then log the event |
Definition at line 100 of file logging.c.
| int log_file_open | ( | bool | verbose | ) |
Start logging to a file.
| verbose | If true, then log the event |
| 0 | Success |
| -1 | Error, see errno |
Before opening a log file, call log_file_set_version(), log_file_set_level() and log_file_set_filename().
Definition at line 121 of file logging.c.
| bool log_file_running | ( | void | ) |
| int log_file_set_filename | ( | const char * | file, |
| bool | verbose ) |
Set the filename for the log.
| file | Name to use |
| verbose | If true, then log the event |
| 0 | Success, file opened |
| -1 | Error, see errno |
Definition at line 151 of file logging.c.
| int log_file_set_level | ( | enum LogLevel | level, |
| bool | verbose ) |
Set the logging level.
| level | Logging level |
| verbose | If true, then log the event |
| 0 | Success |
| -1 | Error, level is out of range |
The level should be: LL_MESSAGE <= level < LL_MAX.
Definition at line 177 of file logging.c.
| void log_file_set_version | ( | const char * | version | ) |