xquic icon indicating copy to clipboard operation
xquic copied to clipboard

[Feature]: document of `xqc_log`

Open Luffbee opened this issue 2 years ago • 4 comments

Before request a new feature

  • [X] I have searched the issues of this repository and believe that this is not a duplicate.

Describe the feature you'd like supported

xqc_log use different format strings from printf, therefore, a document is needed.

Describe alternatives you've considered

No response

Additional context

No response

Luffbee avatar Jul 13 '22 02:07 Luffbee

Does this document solve your problem? Event_log module docs

If not, could you please describe your requirements in more detail

ruiqizhou avatar Jul 26 '22 08:07 ruiqizhou

No, I want a document describe the format string of xqc_log. For example, when I want to print a uint32_t, which format specifier should I use? I used %u once, but it's not working, so the format string is only similar to printf, I want to know the detail differences.

Luffbee avatar Jul 26 '22 08:07 Luffbee

No, I want a document describe the format string of xqc_log. For example, when I want to print a uint32_t, which format specifier should I use? I used %u once, but it's not working, so the format string is only similar to printf, I want to know the detail differences.

We follow the Nginx Formatting. Maybe we should add this link to the document above?

typedef int32_t         xqc_int_t;
typedef uint32_t        xqc_uint_t;
typedef intptr_t        xqc_flag_t;
typedef uint8_t         xqc_bool_t;

so if you want to print uint32_t you should use %ui

ruiqizhou avatar Jul 26 '22 11:07 ruiqizhou

This link is helpful, but I think it's still missing some details, for example, how should I print uint64_t? I looked src/core/ngx_string.c (mentioned in the link), it gives a better explanation. A comment or document like this will be good.

/*
 * supported formats:
 *    %[0][width][x][X]O        off_t
 *    %[0][width]T              time_t
 *    %[0][width][u][x|X]z      ssize_t/size_t
 *    %[0][width][u][x|X]d      int/u_int
 *    %[0][width][u][x|X]l      long
 *    %[0][width|m][u][x|X]i    ngx_int_t/ngx_uint_t
 *    %[0][width][u][x|X]D      int32_t/uint32_t
 *    %[0][width][u][x|X]L      int64_t/uint64_t
 *    %[0][width|m][u][x|X]A    ngx_atomic_int_t/ngx_atomic_uint_t
 *    %[0][width][.width]f      double, max valid number fits to %18.15f
 *    %P                        ngx_pid_t
 *    %M                        ngx_msec_t
 *    %r                        rlim_t
 *    %p                        void *
 *    %[x|X]V                   ngx_str_t *
 *    %[x|X]v                   ngx_variable_value_t *
 *    %[x|X]s                   null-terminated string
 *    %*[x|X]s                  length and string
 *    %Z                        '\0'
 *    %N                        '\n'
 *    %c                        char
 *    %%                        %
 *
 *  reserved:
 *    %t                        ptrdiff_t
 *    %S                        null-terminated wchar string
 *    %C                        wchar
 */

Luffbee avatar Jul 27 '22 02:07 Luffbee