pglogger

functions/NOTICE.pg_sql

Functions

NOTICE
Write log message if logging is set to NOTICE or more severe. To get output on standard out, client_min_messages in postgresql.conf needs to be set to notice or less severe.
Syntax:
NOTICE (I_MESSAGE)
Parameters:
ParameterIn/OutData TypeDescription
I_MESSAGEINTEXTValue for LOG.MESSAGE.
Return values:
  • VOID
Copyright:
Thiemo Kellner, 2018 -
Webpage:
https://www.sourceforge.net/projects/pglogger
Version Info:
$Id: NOTICE.pg_sql 17 2018-06-15 20:23:52Z thiemo $
Additional Info:
License LGPLv3
TODO:
  • 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/NOTICE.pg_sql
002: 
003: /** Write log message if logging is set to NOTICE or more severe.
004:  *  To get output on standard out, client_min_messages in postgresql.conf
005:  *  needs to be set to notice or less severe.
006:  *
007:  *  @function NOTICE
008:  *  @return void
009:  *  @param in text I_MESSAGE Value for LOG.MESSAGE.
010:  *  @version $Id: NOTICE.pg_sql 17 2018-06-15 20:23:52Z thiemo $
011:  *  @todo Once PostgreSQL supports packages, integrate this function into one.
012:  *        For the time being, it should get installed within a schema on its
013:  *        own and no execution grants should be given on it.
014:  *  @todo Once HyperSQL supports a license tag, convert the corresponding
015:  *        info tag into one.
016:  *  @copyright Thiemo Kellner, 2018 -
017:  *  @info License LGPLv3
018:  *  @webpage https://www.sourceforge.net/projects/pglogger
019:  */
020: create or replace function NOTICE(
021:     I_MESSAGE text
022: )
023:   returns void
024:   language plpgsql
025:   security definer
026:   stable
027:   -- Include the hosting schema into search_path so that dblink
028:   -- can find the pglogger objects. There is no need to access
029:   -- objects in other schematas not covered with public.
030:   set search_path = :SCHEMA_NAME, public
031:   as
032: $body$
033:     begin
034:         if
035:             GET_LOGGING_LEVEL() in (
036:                 'NOTICE',
037:                 'INFO',
038:                 'LOG',
039:                 'DEBUG'
040:             )
041:         then
042:             perform WRITE_MESSAGE(
043:                         I_MESSAGE => I_MESSAGE,
044:                         I_LEVEL => 'NOTICE'
045:                     );
046:         end if;
047:     end;
048: $body$;
049: 
050: comment on function NOTICE(I_MESSAGE text) is 'Write log message if logging is set to NOTICE or more severe.
051: To get output on standard out, client_min_messages in postgresql.conf needs to be set to notice or less severe.
052: $Header: svn+ssh://thiemo@svn.code.sf.net/p/pglogger/code/functions/NOTICE.pg_sql 17 2018-06-15 20:23:52Z thiemo $';
053: 
054: commit; -- unlike Oracle not all ddl commit implicitly
055: 
056: \echo End functions/NOTICE.pg_sql


pglogger
Generated by HyperSQL v3.9.8 at Wed Jul 4 07:48:47 2018