-- Module for all code for the logger utility.
CREATE OR REPLACE MODULE LOGGER;

-- Public functions and procedures.
-- Procedure to write logs.
ALTER MODULE LOGGER PUBLISH
 PROCEDURE LOG (
  IN LOGGERID ANCHOR LOGGER.CONF_LOGGERS.LOGGER_ID,
  IN LEVELID ANCHOR LOGGER.LEVELS.LEVEL_ID,
  IN MESSAGE ANCHOR LOGGER.LOGS.MESSAGE
 );

-- Function to register the logger.
ALTER MODULE LOGGER PUBLISH
 FUNCTION GET_LOGGER (
  IN NAME VARCHAR(64)
 ) RETURNS ANCHOR LOGGER.CONF_LOGGERS.LOGGER_ID;

-- Array to store the hierarhy of a logger.
ALTER MODULE LOGGER ADD
 TYPE HIERARCHY_ARRAY AS VARCHAR(32) ARRAY[16];
-- Drops the module if exist.
DROP MODULE LOGGER.LOGGER;

-- Module for all code for the logger utility.
CREATE OR REPLACE MODULE LOGGER;

-- Public functions and procedures.
-- Procedure to write logs.
ALTER MODULE LOGGER PUBLISH
 PROCEDURE LOG (
  IN LOGGERID ANCHOR LOGGER.CONF_LOGGERS.LOGGER_ID,
  IN LEVELID ANCHOR LOGGER.LEVELS.LEVEL_ID,
  IN MESSAGE ANCHOR LOGGER.LOGS.MESSAGE
 );

-- Function to register the logger.
ALTER MODULE LOGGER PUBLISH
 FUNCTION GET_LOGGER (
  IN NAME VARCHAR(64)
 ) RETURNS ANCHOR LOGGER.CONF_LOGGERS.LOGGER_ID;

-- Array to store the hierarhy of a logger.
--ALTER MODULE LOGGER ADD
-- TYPE HIERARCHY_ARRAY AS VARCHAR(32) ARRAY[16];
Drop module and no array
Drop module and no array
