Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: document of xqc_log #206

Open
1 task done
Luffbee opened this issue Jul 13, 2022 · 4 comments
Open
1 task done

[Feature]: document of xqc_log #206

Luffbee opened this issue Jul 13, 2022 · 4 comments
Labels
📖 documentation Improvements or additions to documentation help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request.

Comments

@Luffbee
Copy link

Luffbee commented Jul 13, 2022

Before request a new feature

  • 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

@ruiqizhou ruiqizhou added the 📖 documentation Improvements or additions to documentation label Jul 26, 2022
@ruiqizhou
Copy link
Collaborator

Does this document solve your problem? Event_log module docs

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

@Luffbee
Copy link
Author

Luffbee commented Jul 26, 2022

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.

@ruiqizhou
Copy link
Collaborator

ruiqizhou commented Jul 26, 2022

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

@Luffbee
Copy link
Author

Luffbee commented Jul 27, 2022

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
 */

@ruiqizhou ruiqizhou added the help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. label Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request.
Projects
None yet
Development

No branches or pull requests

2 participants