functions/EXCEPTION.pg_sql
Functions
| EXCEPTION | 
|---|
| Write log message if logging is set to EXCEPTION or more severe. Beware: When using EXCEPTION this means that the error is being re-raised. It really is meant only for fatal occurrences.    Syntax:EXCEPTION (I_MESSAGE)Parameters:| Parameter | In/Out | Data Type | Description | 
|---|
 | I_MESSAGE | IN | TEXT | Value for LOG.MESSAGE. | 
Return values:Copyright:Thiemo Kellner, 2018 -Webpage:https://www.sourceforge.net/projects/pgloggerVersion Info:$Id: EXCEPTION.pg_sql 7 2018-06-12 04:15:42Z thiemo $Additional Info:License LGPLv3TODO:Once PostgreSQL supports packages, integrate this function into one. For the time being, it should get installed within a schema on its own and no execution grants should be given on it.Once HyperSQL supports a license tag, convert the corresponding info tag into one.
 | 
Source
001: \echo Start functions/EXCEPTION.pg_sql
002: 
003: 004: 005: 006: 007: 008: 009: 010: 011: 012: 013: 014: 015: 016: 017: 018: 019: 
020: create or replace function EXCEPTION(
021:     I_MESSAGE text
022: )
023:   returns void
024:   language plpgsql
025:   security definer
026:   stable
027: 028: 029: 030:   set search_path = :SCHEMA_NAME, public
031:   as
032: $body$
033:     begin
034:         if
035:             GET_LOGGING_LEVEL() in (
036:                 'EXCEPTION',
037:                 'WARNING',
038:                 'NOTICE',
039:                 'INFO',
040:                 'LOG',
041:                 'DEBUG'
042:             )
043:         then
044:             perform WRITE_MESSAGE(
045:                         I_MESSAGE => I_MESSAGE,
046:                         I_LEVEL => 'EXCEPTION'
047:                     );
048:         end if;
049:     end;
050: $body$;
051: 
052: comment on function EXCEPTION(I_MESSAGE text) is 'Write log message if logging is set to EXCEPTION.
053: Beware: When using EXCEPTION this means that the error is being re-raised. It really is meant only for fatal occurrences.
054: $Header: svn+ssh://thiemo@svn.code.sf.net/p/pglogger/code/functions/EXCEPTION.pg_sql 7 2018-06-12 04:15:42Z thiemo $';
055: 
056: commit; 057: 
058: \echo End functions/EXCEPTION.pg_sql
  Generated by 
HyperSQL v3.9.8 at Wed Jul  4 07:48:47 2018