Write To A Log File From A Neovim Lua Plugin

This is the function I'm using while working on Neovim plugins.

local log_to_file = function(message, path)
    local log_file_path = path 
    local log_file = io.open(log_file_path, "a")
    io.output(log_file)
    io.write(message.."\n")
    io.close(log_file)
end
~ fin ~