Skip to content

New logging mechanics #1873

Nov 21, 2022 · 7 comments · 8 replies
Discussion options

You must be logged in to vote

@rafalsk

Mongoose uses its own family of printf functions, where the lowest level is this:

size_t mg_xprintf(void (*out)(char, void *), void *param, const char *fmt, ...);

It outputs a formatted string to a "printer function". We chose a signature for that "printer function" to be a per-byte printer:

typedef void (*mg_pfn_t)(char, void *);

The alternative was to use a "memory chunk" printer:

typedef void (*mg_pfn_t)(const void *buf, size_t len, void *);

Why did we use a per-byte printer? Because it is simpler. Yes it is not that as efficient as an alternative, but in our design priorities, simplicity stays above performance.

In this particular case, the alternative is also simple enough, …

Replies: 7 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@scaprile
Comment options

@rafalsk
Comment options

@scaprile
Comment options

@rafalsk
Comment options

@rafalsk
Comment options

Comment options

You must be logged in to vote
1 reply
@scaprile
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by scaprile
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@rafalsk
Comment options

@cpq
Comment options

cpq Nov 24, 2022
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1872 on November 21, 2022 12:07.