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

logging memory address of a table #1457

Closed
ms2008 opened this issue Jan 19, 2019 · 2 comments
Closed

logging memory address of a table #1457

ms2008 opened this issue Jan 19, 2019 · 2 comments

Comments

@ms2008
Copy link

ms2008 commented Jan 19, 2019

Is there a way to log the table's address by ngx.log? Just same as PUC Lua print({}) outputs table: 0xcc1e00 . This feature would be extremely useful for debugging the weak table related issues.

@agentzh
Copy link
Member

agentzh commented Jan 19, 2019

@ms2008 Just use the tostring() Lua API function yourself to generate such strings.

@agentzh
Copy link
Member

agentzh commented Jan 19, 2019

@ms2008 A quick example:

$ resty -e 'ngx.log(ngx.WARN, tostring{ dog = 3 })'
2019/01/19 12:58:32 [warn] 898#898: *2 [lua] (command line -e):1: table: 0x7f25a530f508, context: ngx.timer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants