leslie-tsang opened a new pull request #5660:
URL: https://github.com/apache/apisix/pull/5660
### What this PR does / why we need it:
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
Currently APISIX `apisix.core.log` test case 6 don't work as expect, this PR
fixes it.
Both test case config can pass the prove, which was unexpected.
```
=== TEST 6: print error log with prefix
--- config
location /t {
content_by_lua_block {
local log = require("apisix.core").log.new("test: ")
log.error("error log")
log.warn("warn log")
log.notice("notice log")
log.info("info log")
ngx.say("done")
}
}
--- log_level: error
--- request
GET /t
--- error_log
error log
--- no_error_log
test: warn log
test: notice log
test: info log
```
```
=== TEST 6: print error log with prefix
--- config
location /t {
content_by_lua_block {
local log = require("apisix.core").log
log.error("error log")
log.warn("warn log")
log.notice("notice log")
log.info("info log")
ngx.say("done")
}
}
--- log_level: error
--- request
GET /t
--- error_log
error log
--- no_error_log
test: warn log
test: notice log
test: info log
```
### Pre-submission checklist:
<!--
Please follow the requirements:
1. Use Draft if the PR is not ready to be reviewed
2. Test is required for the feat/fix PR, unless you have a good reason
3. Doc is required for the feat PR
4. Use a new commit to resolve review instead of `push -f`
5. Use "request review" to notify the reviewer once you have resolved the
review
-->
* [x] Did you explain what problem does this PR solve? Or what new features
have been added?
* [ ] Have you added corresponding test cases?
* [ ] Have you modified the corresponding document?
* [ ] Is this PR backward compatible? **If it is not backward compatible,
please discuss on the [mailing
list](https://github.com/apache/apisix/tree/master#community) first**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]