【发布时间】:2021-01-29 20:27:00
【问题描述】:
我正在使用tarantool/tarantool:2.6.0 Docker 映像(目前最新)并为该项目编写 lua 脚本。我试图找出如何查看调用print() 函数的结果。如果没有 print() 工作,调试我的代码非常困难。
在 tarantool 控制台 print() 也没有效果。
使用简单的 print()
文档说 print() 对 stdout 有效,但是当我查看 docker logs -f <CONTAINER_NAME> 的容器日志时,我没有看到任何结果
我还尝试将容器的日志驱动程序设置为local。比我一次打印到容器的日志,但只有一次......
容器的/var/log 目录始终为空。
使用 box.session.push()
在控制台中使用box.session.push() 可以正常工作,但是当我在 lua 脚本中使用它时:
-- app.lua
function log(s)
box.session.push(s)
end
-- No effect
log('hello')
function say_something(s)
log(s)
end
box.schema.func.create('say_something')
box.schema.user.grant('guest', 'execute', 'function', 'say_something')
然后像这样从 nodeJs 连接器调用say_something():
const TarantoolConnection = require('tarantool-driver');
const conn = new TarantoolConnection(connectionData);
const res = await conn.call('update_links', 'hello');
有什么建议吗? 谢谢!
【问题讨论】:
标签: tarantool