TEXT
PACKAGE tpp_log
/**
 * Project:         Project (<a href="http://en.1stsw.com/products/transactional-parallel-processing/">1. SOFTWAROVÁ s.r.o.</a>)<br/>
 * Description:     Package for loging trace log into TRACE_LOG table.<br/>
 * Author:          Petr Jezek<br/>
 * Version:         2.0.1<br/>
 * Date:            2012-09-18<br/>
 * <br/>
 * @headcom
 */
is
/**
 * List of exceptions
 */
  c_err_missing_debug_level   constant PLS_INTEGER := -20002;
  c_err_missing_maintance_par constant PLS_INTEGER := -20003;

/**
 * List of statuses of g_log_level
 */
  c_fatal              constant pls_integer := 1;
  c_error              constant pls_integer := 2;
  c_warning            constant pls_integer := 3;
  c_info               constant pls_integer := 4;
  c_debug              constant pls_integer := 5;
  c_user_log           constant pls_integer := 6;

/**
 * Variable g_log_level is globaly defined for whole log package.
 * It is initially loaded from setting from CONF_PARAM table.
 * In exceptional case it can be overloaded.
 */
  g_log_level          number := null;

/**
 * It is initially loading value of global variable g_log_level from CONF_PARAM.
 * When configuration is not set correctly the debug level, then it raise exception MISSING_DEBUG_LEVEL.
 * According the debug level is apropriate call of log_trace inserted record into TRACE_LOG table.
 * @throws C_ERR_MISSING_DEBUG_LEVEL There is missing configuration of log level in CONF_PRAM table. The should be column NAME = 'LOG_LEVEL' with column VAL with numeric value. Then of VAL should be one of the "List of statuses"
 *
 */
  procedure log_trace(
    p_severity_id    in number   -- 1 - fatal, 2 - error, 3 - warning, 4 - info, 5 - debug
   ,p_procedure_name in varchar2 -- Name of procedure for log
   ,p_description    in varchar2 -- Trace description. Max length for log is 4000.
  );

/**
 * It is maintance procedure to delete old data in TRACE_LOG table.
 * There is expected in table CONF_PARAM configuration (NAME = 'CLEAN_OLDER_THEN_X_DAYS') with number of days.
 * Records in TRACE_LOG older then CLEAN_OLDER_THEN_X_DAYS days will be automaticly delete weekly by job.
 * @throws C_ERR_MISSING_MAINTANCE_PAR There is missing configuration of log level in CONF_PARAM table. The should be column NAME = 'CLEAN_OLDER_THEN_X_DAYS' with column VAL with numeric value. Then of VAL should be numeric. Higer then 0.
 *
 */
  procedure clean_old_logs;


end tpp_log;