Tuning up Lua #1. How to add newline instead of \n?

Good day!
I’ve been testing nakama for a month or so. I’ve already created custom logic for server authoritative match on Lua and tried a few other API calls.
Nakama and Lua are really nice, but I’d like to tune up lua part a bit. First of all, I’d like to see newline every time, when I call with “\n”
nk.logger_info("One line\nSome other line\n...")
The other place, where it’d be good to have this one, is on printing stacktrace:

{"level":"error","ts":"2022-02-03T22:13:39.731+0100","caller":"server/runtime_lua.go:1889","msg":"Could not complete runtime invocation","error":"/nakama/data/modules/birds.lua:8: attempt to index a non-table object(nil) with key 'leaderboard_create'\nstack traceback:\n\t/nakama/data/modules/birds.lua:8: in main chunk\n\t[G]: ?"}

Yeap, I see, that this is one line, containing timestamp, caller and so on, enclosed in curly bracers. In case of traceback, I’d probably put “error” string out of curly bracers and added one tab before every line in error string. Note, tabs make it prettier, but they are not the main target in the feature. The main target is to have new lines.

Thanks!

Hello @andrecrow, can you elaborate on why you need this?

Please note that the log messages are JSON-formatted, so multi-line strings and moving errors outside it are not supported/would break this standard.

Hello @ftkg !
I’m experimenting with match-3 gameplay, and it would be great to view field in log like this:

{"level":"info","ts":"2022-02-25T14:36:31.975Z","caller":"server/runtime_lua_nakama.go:1778","runtime":"lua"}
1 1 2 1 3
2 3 1 2 3
3 1 1 2 4
1 4 2 3 1

and not like this:

{"level":"info","ts":"2022-02-25T14:36:31.975Z","caller":"server/runtime_lua_nakama.go:1778","msg":"1 1 2 1 3\n2 3 1 2 3\n3 1 1 2 4\n1 4 2 3 1","runtime":"lua"}

As well as have stacktrace starting at new line, one stack frame per line and not buried under

{"level":"error","ts":"2022-02-03T22:13:39.731+0100","caller":"server/runtime_lua.go:1889",

@andrecrow In that case, can you submit a pull request with a text format logger output (non-JSON) option?

That should be fairly straightforward.