File: n_cst_log.sru
Size: 1234
Date: Sat, 08 Dec 2007 15:38:24 +0100
$PBExportHeader$n_cst_log.sru
$PBExportComments$Simple Logger
forward
global type n_cst_log from nonvisualobject
end type
end forward

global type n_cst_log from nonvisualobject
end type
global n_cst_log n_cst_log

type variables
string is_message[]
long il_loglevel

end variables

forward prototypes
public subroutine of_addmessage (integer ai_level, string as_message)
public function string of_getlog (integer ai_loglevel)
end prototypes

public subroutine of_addmessage (integer ai_level, string as_message);is_message [ai_level] += as_message + "<BR />~r~n"

return
end subroutine

public function string of_getlog (integer ai_loglevel);if  ai_loglevel > 0 and ai_loglevel <= UpperBound (is_message) then &
   return is_message [ai_loglevel]
return ""
end function

on n_cst_log.create
call super::create
TriggerEvent( this, "constructor" )
end on

on n_cst_log.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on

event constructor;
/* Override this event when using another approach */
string ls_PWEIniFile
ls_PWEIniFile = CGIEnv.of_getINIFileName( )

il_loglevel = Long ( ProfileString(ls_PWEIniFile, getapplication().appname ,"loglevel", "0" ))

end event