NeoMutt  2024-12-12-14-g7b49f7
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
logging.c File Reference

Log everything to the terminal. More...

#include "config.h"
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "mutt/lib.h"
#include "lib.h"
+ Include dependency graph for logging.c:

Go to the source code of this file.

Functions

static int log_timestamp (char *buf, size_t buflen, time_t time)
 Write a timestamp to a buffer.
 
static int log_level (char *buf, size_t buflen, enum LogLevel level)
 Write a log level to a buffer.
 
int log_disp_debug (time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...)
 Display a log line on screen - Implements log_dispatcher_t -.
 

Variables

bool DebugLogColor = false
 Output ANSI colours.
 
bool DebugLogLevel = false
 Prefix log level, e.g. [E].
 
bool DebugLogTimestamp = false
 Show the timestamp.
 
const char * LevelAbbr
 Abbreviations of logging level names.
 

Detailed Description

Log everything to the terminal.

Authors
  • Richard Russon

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 logging.c.

Function Documentation

◆ log_timestamp()

static int log_timestamp ( char *  buf,
size_t  buflen,
time_t  time 
)
static

Write a timestamp to a buffer.

Parameters
bufBuffer for the result
buflenLength of the buffer
timeTimestamp
Return values
numBytes written to buffer

Definition at line 52 of file logging.c.

53{
54 return mutt_date_localtime_format(buf, buflen, "[%H:%M:%S]", time);
55}
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:951
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log_level()

static int log_level ( char *  buf,
size_t  buflen,
enum LogLevel  level 
)
static

Write a log level to a buffer.

Parameters
bufBuffer for the result
buflenLength of the buffer
levelLog level
Return values
numBytes written to buffer

Write the log level, e.g. [E]

Definition at line 66 of file logging.c.

67{
68 return snprintf(buf, buflen, "<%c>", LevelAbbr[level + 3]);
69}
const char * LevelAbbr
Abbreviations of logging level names.
Definition: logging.c:46
+ Here is the caller graph for this function:

Variable Documentation

◆ DebugLogColor

bool DebugLogColor = false

Output ANSI colours.

Definition at line 39 of file logging.c.

◆ DebugLogLevel

bool DebugLogLevel = false

Prefix log level, e.g. [E].

Definition at line 40 of file logging.c.

◆ DebugLogTimestamp

bool DebugLogTimestamp = false

Show the timestamp.

Definition at line 41 of file logging.c.

◆ LevelAbbr

const char* LevelAbbr
extern

Abbreviations of logging level names.

Definition at line 46 of file logging.c.