Page Blocks

Hosting sponsored by:

Point In Space

 

API: Log

Filename:
fwpLog_custom.ctag

Released With:
5.0.0

Current Version:
1.0.1

Status: Active

Min Lasso Tested: 8.1.0

Max Lasso Tested: 8.5.3

Related:

Still don't get it?

Check out the talk list archives, or join and ask your questions.

Documentation Error or Request?

Email documentation corrections or comments

API Reference

fwpLog_custom (Tag)

Description

Write to a tab delimited log file certain page information along with an application-defined string (which may contain \t characters to create individual fields). Logging can be turned on|off by setting the variable $fw_gLogCustom to true|false. Log rolling can be set to annual, monthly, weekly, or daily by settingthe _siteConfig variable $fw_gLogCustomRoll to 'A|M|W|D'.

The following items are logged with tab separators:
[server_date: -extended]
[server_time]
[Client_IP]
[Response_FilePath]
[Referrer_URL]
string = the custom string

Syntax

fwpLog_custom: string

Parameters & Member Tags

string (unnamed) - required : any string to be recorded. Can contain \t characters to create separate fields, but cannot not contain any line ending characters such as \r, \n, or \r\n.

Examples

fwpLog_custom: $myActionEvents;

Source Code

View in separate window

<?lassoscript
//............................................................................
//
//    pageblocks: (c) 2002-2007 http://www.pageblocks.org/
//
//............................................................................
/*

    {fileName=        fwpLog_custom.ctag }
    {rsrcType=        tag }
    {rsrcName=        fwpLog_custom }
    {rsrcHTTP=        www.pageblocks.org/refc/fwpLog_custom }

    {lassoVrsnMin=    8.1.0 }
    {lassoVrsnMax=    8.5.3 }

    {author=        Greg Willits }
    {authorEmail=    subscribe to pbTalk at www.pageblocks.org/talk/ }
    {authorHTTP=    www.pageblocks.org }

    {desc=            Creates a log of whatever is input. }

    {maintvsrn=        1.1 }
    {maintrelease=    5.2.0 }
    {maintdate=        2007-06-09 }
    {maintauthor=    Greg Willits }
    {maintnotes=    added log_critical }

    {maintvsrn=        1.0.1 }
    {maintrelease=    5.0.0 b5 }
    {maintdate=        2006-02-02 }
    {maintauthor=    Greg Willits }
    {maintnotes=    changed db/tbl references to use new vars }

    {maintvsrn=        1.0 }
    {maintrelease=    5.0.0 }
    {maintdate=        2006-01-16 }
    {maintauthor=    Greg Willits }
    {maintnotes=    initial release }

*/
//.............................................................................

define_tag:'fwpLog_custom', 
    -autooutput,
    -priority='replace',
    -required='file',
    -required='string';

    local:'fw_logFileNm'=($fw_sPath->'logs') + #file + 'log_' + (date->year);

    //    backwards compatibility
    //    doesn`t require the declaration of fw_gLogCustomTarget

    if: !(global_defined:'fw_gLogCustomTarget');
        $fw_gLogCustomTarget = 'file';
    /if;

    if: $fw_gLogCustomTarget == 'file';

        inline:
            -username=$fw_gFilesUser,
            -password=$fw_gFilesPswd;
    
            select: $fw_gLogCustomRoll;
                case:'M';
                    #fw_logFileNm += '_m' + (date->month);
                case:'W';
                    #fw_logFileNm += '_w' + (date->week);
                case:'D';
                    #fw_logFileNm += '_d' + (date->dayofyear);
            /select;
            #fw_logFileNm += '.txt';
    
            log: #fw_logFileNm;
                server_date: -extended;
                '\t';
                server_time;
                '\t';
                client_IP;
                '\t';
                response_filepath;
                '\t';
                referrer_URL;
                '\t';
                local:'string', -encodenone;
                '\n';
            /log;

            $fw_criticalLog && ((file_currentError: -errorcode)  != 0)
                ? log_critical:('pbError : fwpLog_custom -- ' + file_currentError);
                
        /inline;

    else: $fw_gLogCustomTarget == 'database';
    
        inline:
            -username=$fw_gQueryUser,
            -password=$fw_gQueryPswd;
        
            //    update a standard database table for this
            //    ::NOTE:: this obviously isn't done yet

        /inline;
    
    /if;
/define_tag;
?>

© 2002-2010, pageblocks.org