MINI MINI MANI MO
Rem
Rem $Header: sdo/admin/pg/opglogh.sql /main/5 2017/09/29 09:00:20 alwu Exp $
Rem
Rem opglogh.sql
Rem
Rem Copyright (c) 2013, 2017, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem opglogh.sql - <one-line expansion of the name>
Rem
Rem DESCRIPTION
Rem <short description of component this file declares/defines>
Rem
Rem NOTES
Rem <other useful comments, qualifications, etc.>
Rem
Rem MODIFIED (MM/DD/YY)
Rem alwu 09/28/17 - shorten several API names
Rem alwu 03/23/17 - XbranchMerge alwu_bug-24319503 from
Rem st_sdo_12.2.0.1.0
Rem alwu 08/02/16 - fix bug 24312220
Rem alwu 12/03/15 - add SQL FILE metadata
Rem alwu 07/23/15 - fix bug 21226251
Rem alwu 01/21/14 - add mdsys to package names
Rem alwu 11/15/13 - start
Rem alwu 11/15/13 - Created
Rem
Rem BEGIN SQL_FILE_METADATA
Rem SQL_SOURCE_FILE: sdo/admin/pg/opglogh.sql
Rem SQL_SHIPPED_FILE: md/admin/opglogh.sql
Rem SQL_PHASE: OPGLOGH
Rem SQL_STARTUP_MODE: NORMAL
Rem SQL_IGNORABLE_ERRORS: NONE
Rem SQL_CALLING_FILE: sdo/admin/pg/opgrelod.sql
Rem END SQL_FILE_METADATA
SET ECHO ON
SET FEEDBACK 1
SET NUMWIDTH 10
SET LINESIZE 80
SET TRIMSPOOL ON
SET TAB OFF
SET PAGESIZE 100
create or replace package mdsys.opg_log as
NEWLINE constant char(1) := chr(10);
DEFAULT_LOG_LEVEL constant integer := 0;
--
-- By default, log goes to trace files
--
procedure set_log_output(vcDest varchar2);
procedure set_log_level(i integer);
function get_log_level return integer;
function is_fatal_enabled return boolean;
function is_error_enabled return boolean;
function is_warning_enabled return boolean;
function is_assertion_enabled return boolean;
function is_info_enabled return boolean;
function is_debug_enabled return boolean;
function get_caller_info return varchar2;
/**
* The following two methods (fatal, error) will un-ambiguously record
* the error message, plus line number for this method call,
* plus exception location if applicable,
* plus call stack trace.
* e.g.
*
* Case 1: there is no exception. Just an unexpected error condition.
* if (...) then
* opg_log.error('test3: should never be true');
* end if;
* ==>
* "110015, MDSYS" @time: 0 [error] test3: should never be true
* Line# 349 in package body MDSYS.OPG_LOG
* Line# 358 in package body MDSYS.OPG_LOG
* Line# 367 in package body MDSYS.OPG_LOG
* Line# 1 in anonymous block
*
* Case 2: there is exception caught in the exception block
* begin
* ...
* exception
* when others then
* opg_log.error('test1: Caught exception');
* raise;
* end;
* ==>
* "110015, MDSYS" @time: 0 [error] test1: Caught exception
* ORA-20000: test2 error happened
* ORA-06512: at "MDSYS.OPG_LOG", line 342
* ORA-06512: at "MDSYS.OPG_LOG", line 352
* ORA-06512: at "MDSYS.OPG_LOG", line 358
* Line# 361 in package body MDSYS.OPG_LOG
* Line# 367 in package body MDSYS.OPG_LOG
* Line# 1 in anonymous block
*/
procedure fatal(vcMsg varchar2);
procedure error(vcMsg varchar2);
procedure warning(vcMsg varchar2) ;
procedure info (vcMsg varchar2) ;
procedure debug (vcMsg varchar2) ;
procedure debug_nh(vcMsg varchar2) ;
procedure assert(b boolean, vcMsg varchar2);
/** Testing (Unit Testing) Code Starts Next. TODO: to be removed before
production **/
procedure test;
end;
/
show errors;
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@?/rdbms/admin/sqlsessend.sql
Rem ********************************************************************
OHA YOOOO