documented the log_by_lua_block {} directive.

This commit is contained in:
Yichun Zhang (agentzh) 2015-10-27 11:55:17 +08:00
Родитель acc8239910
Коммит 9afe2066a0
2 изменённых файлов: 63 добавлений и 4 удалений

Просмотреть файл

@ -1091,6 +1091,7 @@ Directives
* [body_filter_by_lua_block](#body_filter_by_lua_block)
* [body_filter_by_lua_file](#body_filter_by_lua_file)
* [log_by_lua](#log_by_lua)
* [log_by_lua_block](#log_by_lua_block)
* [log_by_lua_file](#log_by_lua_file)
* [lua_need_request_body](#lua_need_request_body)
* [lua_shared_dict](#lua_shared_dict)
@ -1252,7 +1253,8 @@ init_by_lua
**phase:** *loading-config*
**WARNING** Since the `v0.9.17` release, use of this directive is *discouraged*; use the new [init_by_lua_block](#init_by_lua_block) directive instead.
**WARNING** Since the `v0.9.17` release, use of this directive is *discouraged*;
use the new [init_by_lua_block](#init_by_lua_block) directive instead.
Runs the Lua code specified by the argument `<lua-script-str>` on the global Lua VM level when the Nginx master process (if any) is loading the Nginx config file.
@ -2172,7 +2174,10 @@ log_by_lua
**phase:** *log*
Run the Lua source code inlined as the `<lua-script-str>` at the `log` request processing phase. This does not replace the current access logs, but runs after.
**WARNING** Since the `v0.9.17` release, use of this directive is *discouraged*;
use the new [log_by_lua_block](#log_by_lua_block) directive instead.
Runs the Lua source code inlined as the `<lua-script-str>` at the `log` request processing phase. This does not replace the current access logs, but runs after.
Note that the following API functions are currently disabled within this context:
@ -2228,6 +2233,33 @@ This directive was first introduced in the `v0.5.0rc31` release.
[Back to TOC](#directives)
log_by_lua_block
----------------
**syntax:** *log_by_lua_block { lua-script }*
**context:** *http, server, location, location if*
**phase:** *log*
Similar to the [log_by_lua](#log_by_lua) directive except that this directive inlines
the Lua source directly
inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
special character escaping).
For instance,
```nginx
log_by_lua_block {
print("I need no extra escaping here, for example: \r\nblah")
}
```
This directive was first introduced in the `v0.9.17` release.
[Back to TOC](#directives)
log_by_lua_file
---------------

Просмотреть файл

@ -998,7 +998,8 @@ As from the <code>v0.5.0rc29</code> release, the special notation <code>$prefix<
'''phase:''' ''loading-config''
'''WARNING''' Since the <code>v0.9.17</code> release, use of this directive is ''discouraged''; use the new [[#init_by_lua_block|init_by_lua_block]] directive instead.
'''WARNING''' Since the <code>v0.9.17</code> release, use of this directive is ''discouraged'';
use the new [[#init_by_lua_block|init_by_lua_block]] directive instead.
Runs the Lua code specified by the argument <code><lua-script-str></code> on the global Lua VM level when the Nginx master process (if any) is loading the Nginx config file.
@ -1818,7 +1819,10 @@ This directive was first introduced in the <code>v0.5.0rc32</code> release.
'''phase:''' ''log''
Run the Lua source code inlined as the <code><lua-script-str></code> at the <code>log</code> request processing phase. This does not replace the current access logs, but runs after.
'''WARNING''' Since the <code>v0.9.17</code> release, use of this directive is ''discouraged'';
use the new [[#log_by_lua_block|log_by_lua_block]] directive instead.
Runs the Lua source code inlined as the <code><lua-script-str></code> at the <code>log</code> request processing phase. This does not replace the current access logs, but runs after.
Note that the following API functions are currently disabled within this context:
@ -1871,6 +1875,29 @@ Here is an example of gathering average data for [[HttpUpstreamModule#$upstream_
This directive was first introduced in the <code>v0.5.0rc31</code> release.
== log_by_lua_block ==
'''syntax:''' ''log_by_lua_block { lua-script }''
'''context:''' ''http, server, location, location if''
'''phase:''' ''log''
Similar to the [[#log_by_lua|log_by_lua]] directive except that this directive inlines
the Lua source directly
inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
special character escaping).
For instance,
<geshi lang="nginx">
log_by_lua_block {
print("I need no extra escaping here, for example: \r\nblah")
}
</geshi>
This directive was first introduced in the <code>v0.9.17</code> release.
== log_by_lua_file ==
'''syntax:''' ''log_by_lua_file <path-to-lua-script-file>''