vanilla-zh
  • 简介
  • 快速上手
    • Hello World
    • 如何调试
    • 如何新增一个Controller
    • 如何使用models/dao
    • 如何使用models/service
  • APIs
    • 配置
    • Bootstrap
    • Controllers
    • 模板引擎
    • 插件
    • 路由
    • 异常处理
    • 内建类
  • Libs
    • Cookie
  • 进阶
    • 页缓存
    • 面向对象
    • Vanilla 包开发
  • OpenResty
    • OR文档精炼
      • ngx.timer
      • ngx.config
      • coroutine
      • ngx.thread
  • ChangeLogs
    • vanilla-0.1.0.rc7
    • vanilla-0.1.0.rc6
    • vanilla-0.1.0.rc5
    • vanilla-0.1.0.rc4
    • vanilla-0.1.0.rc3
  • 杂项
    • Nginx执行阶段
    • GDB 调试 OpenResty
    • OpenResty 正则示例收集
    • 基于 OpenResty 安装 Luarocks
    • Vanilla集成的一些优秀第三方包
      • QCon 2015 Broken Performance Tools
  • Vanilla使用经验
    • 用户列表
Powered by GitBook
On this page
  • sprint_r,print_r,lprint_r,err_log
  • sprint_r
  • print_r
  • lprint_r
  • err_log

Was this helpful?

  1. 快速上手

如何调试

除了查看 nginx 错误日志辅助开发外,为了方便 Vanilla 项目的开发和调试,Vanilla 提供了诸如 print_r 之类的对象输出方法,以及详细友好的页面报错输出,你不需要到服务器日志去查看,就能所见即所得的开发调试代码.

sprint_r,print_r,lprint_r,err_log

sprint_r

将 LUA 对象等格式化为易读的字符串返回

print_r

类似 ngx.say 的效果,将对象、变量等以易读的格式进行输出,适用于 Vanilla 开发的 Web 服务

lprint_r

print_r 的 CLI 版本,适用于 v-console 命令行环境

╰─○ v-console-0.1.0.rc6
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
v-console>a={}
v-console>a.v1='a_v1'
v-console>a.v2='a_v2'
v-console>lprint_r(a)
{
  v2 = "a_v2",
  v1 = "a_v1"
}
v-console>

err_log

err_log 方法是对 ngx.ERR 的封装,将 msg 记录到 nginx 错误日志

PreviousHello WorldNext如何新增一个Controller

Last updated 6 years ago

Was this helpful?