Quest Archive Manager Connector 23.4

# LuaLogService:new

The constructor for a `LuaLogService` object (creates a new `LuaLogService`).

IMPORTANT: Do not create a new log service to write messages to log types that are defined in the Quest Archive Manager Connector configuration file. Instead use the same log service as Quest Archive Manager Connector, by calling get_log_service, or obtain a `LuaLog` object through the function get_log.

## Syntax

    LuaLogService:new( config )

## Arguments

Argument | Description
--- | ---
`config` | (LuaConfig) The configuration object to read the logging settings from. You can obtain a LuaConfig object through the function get_config.

## Returns

(LuaLogService). The new `LuaLogService` object.

## Example

The following example creates a `LuaLogService` object to write log messages to a custom log file named `lua.log`. Declare the log service globally to avoid a `LuaLogService` object being created every time the script runs. For example, if you are writing a Lua script to use with a connector or CFS, create the `LuaLogService` outside the `handler` function. Otherwise, the server creates a `LuaLogService` object for every document that is processed.

    local luaConfigString = [===[
    [Logging]
    LogLevel=FULL
    0=LuaLogStream

    [LuaLogStream]
    LogTypeCSVs=lua
    LogFile=lua.log
    ]===]

    local config = LuaConfig:new(luaConfigString)

    -- global log service instance for Lua log stream
    luaLogService = LuaLogService:new(config)

    local luaLog = luaLogService:get_log("lua")
    luaLog:write_line(log_level_normal(), "running Lua script")

Copyright 2023 Open Text
Version 23.4 | Last updated September 2023

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Quest Archive Manager Connector 23.4

Topic Title: LuaLogService:new