ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
named.c File Reference

Format named objects in log messages (replaces hex addresses with type/name descriptions). More...

Go to the source code of this file.

Macros

#define LOG_NAMED_ID_BUFFER_SIZE   64
#define LOG_NAMED_TEMP_OUTPUT_BUFFER_SIZE   512
#define LOG_NAMED_ID_EXTENDED_BUFFER_SIZE   128
#define LOG_NAMED_TYPE_BUFFER_SIZE   64
#define LOG_NAMED_KW_BUFFER_SIZE   32
#define LOG_NAMED_TEMP_BUFFER_SIZE   512
#define LOG_NAMED_TYPE_SHORT_BUFFER_SIZE   32
#define LOG_NAMED_TYPE_EXTENDED_BUFFER_SIZE   256
#define LOG_NAMED_NAME_BUFFER_SIZE   256
#define LOG_NAMED_ADDR_BUFFER_SIZE   128
#define NAMED_FORMAT_BUFFER_SIZE   (4096)
#define COLORIZE_BUFFERS   4
#define COLORIZE_BUFFER_SIZE   512

Functions

int log_named_format_message (const char *message, char *output, size_t output_size)
 Format hex addresses in a message as named object descriptions.
const char * log_named_format_or_original (const char *message)
 Format named objects in a message (thread-local buffer).
const char * colorize_named_string (const char *name_str)
 Colorize a "type/name (0xaddress)" string for display in memory reports.

Detailed Description

Format named objects in log messages (replaces hex addresses with type/name descriptions).

This module scans log message text for hex addresses (0x[0-9a-fA-F]+) and replaces them with friendly descriptions from the named object registry when available. For example, 0x7f1234567890 might become "mutex/recv_mutex.2 (0x7f1234567890)"

Output is colorized for better readability:

  • Type name: yellow (LOG_COLOR_WARN)
  • Name: orange (LOG_COLOR_DEV)
  • ID value: grey (LOG_COLOR_GREY)

Definition in file log/named.c.

Macro Definition Documentation

◆ COLORIZE_BUFFER_SIZE

#define COLORIZE_BUFFER_SIZE   512

Referenced by colorize_named_string().

◆ COLORIZE_BUFFERS

#define COLORIZE_BUFFERS   4

Referenced by colorize_named_string().

◆ LOG_NAMED_ADDR_BUFFER_SIZE

#define LOG_NAMED_ADDR_BUFFER_SIZE   128

Definition at line 26 of file log/named.c.

Referenced by colorize_named_string().

◆ LOG_NAMED_ID_BUFFER_SIZE

#define LOG_NAMED_ID_BUFFER_SIZE   64

Definition at line 17 of file log/named.c.

Referenced by log_named_format_message().

◆ LOG_NAMED_ID_EXTENDED_BUFFER_SIZE

#define LOG_NAMED_ID_EXTENDED_BUFFER_SIZE   128

Definition at line 19 of file log/named.c.

◆ LOG_NAMED_KW_BUFFER_SIZE

#define LOG_NAMED_KW_BUFFER_SIZE   32

Definition at line 21 of file log/named.c.

Referenced by log_named_format_message().

◆ LOG_NAMED_NAME_BUFFER_SIZE

#define LOG_NAMED_NAME_BUFFER_SIZE   256

Definition at line 25 of file log/named.c.

Referenced by colorize_named_string().

◆ LOG_NAMED_TEMP_BUFFER_SIZE

#define LOG_NAMED_TEMP_BUFFER_SIZE   512

Definition at line 22 of file log/named.c.

Referenced by log_named_format_message().

◆ LOG_NAMED_TEMP_OUTPUT_BUFFER_SIZE

#define LOG_NAMED_TEMP_OUTPUT_BUFFER_SIZE   512

Definition at line 18 of file log/named.c.

Referenced by log_named_format_message().

◆ LOG_NAMED_TYPE_BUFFER_SIZE

#define LOG_NAMED_TYPE_BUFFER_SIZE   64

Definition at line 20 of file log/named.c.

◆ LOG_NAMED_TYPE_EXTENDED_BUFFER_SIZE

#define LOG_NAMED_TYPE_EXTENDED_BUFFER_SIZE   256

Definition at line 24 of file log/named.c.

Referenced by colorize_named_string().

◆ LOG_NAMED_TYPE_SHORT_BUFFER_SIZE

#define LOG_NAMED_TYPE_SHORT_BUFFER_SIZE   32

Definition at line 23 of file log/named.c.

Referenced by log_named_format_message().

◆ NAMED_FORMAT_BUFFER_SIZE

#define NAMED_FORMAT_BUFFER_SIZE   (4096)

Definition at line 37 of file log/named.c.

Referenced by log_named_format_or_original().