Logging subsystemΒΆ

There are three types of message tracing that may be enabled in the OPC-UA server:

  • Debugging messages
  • Information messages
  • Error messages

All information is by default sent to the trace function. You may override the message tracing as follows:

local ua = require("opcua.api")
-- Debug messages
ua.log.dbg = function(msg)
  print(sock.gettime(), "[DBG] ", msg)
end

-- Information messages
ua.log.inf = function(msg)
  print(sock.gettime(), "[INF]", msg)
end

-- Errors highlighted with red color on POSIX terminals
ua.log.err = function(msg)
  print(sock.gettime(), "\27[31m[ERR]\27[39m", msg)
end