2009-01-18 21:39 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com)
  + harbour/source/rdd/usrrdd/example/exlog.prg
  + harbour/source/rdd/usrrdd/rdds/logrdd.prg
  * harbour/source/rdd/usrrdd/rdds/Makefile
    + Added new LOGRDD rdd file and related example
    ; NOTE: A simple RDD which introduce logging to file. It inheriths from
            any existent RDD but if you write / replace / delete something
            on tables it writes changes in a log file.
            It needs to inherit a standard RDD to which it adds logging
            capabilities.
            Related functions:
            hb_LogRddInherit() -> <cRDDName>
REQUESTED - It must returns the standard RDD name to be inherited. This function HAVE to be defined from user in application.
            hb_LogRddLogFileName( [<cFileName>] ) -> <cOldFileName>
OPTIONAL - Set/Get logging file name (default "changes.log").
            hb_LogRddTag( [<cTag>] ) -> <cOldTag>
              OPTIONAL  - Set/Get Tag string added in each log line.
                          (default COMPUTERNAME\UserName)
            hb_LogRddActive( [<lActive>] ) -> <lOldActive>
              OPTIONAL  - Set/Get logging active status (default .F.).



Example:

#include "dbinfo.ch"

// Request for LOGRDD rdd driver
REQUEST LOGRDD

// Here put Request for RDD you want to inherit then add
// function hb_LogRddInherit() (see at bottom)
REQUEST DBFCDX

PROCEDURE Main()

   // Set LOGRDD as default RDD otherwise I have to set explicitly use
   // with DRIVER option
   RDDSetDefault( "LOGRDD" )
   // Adding Memofile Info
   rddInfo( RDDI_MEMOVERSION, DB_MEMOVER_CLIP, "LOGRDD" )

   // Define Log File Name and position
   hb_LogRddLogFileName( "logs\changes.log" )
   // Define Tag to add for each line logged
   hb_LogRddTag( NETNAME() + "\" + hb_USERNAME() )
   // Activate Logging, it can be stopped/started at any moment
   hb_LogRddActive( .T. )

   // Start program logic

   // Open a table with logging (default RDD is LOGRDD)
   USE test
   field->name := "Francesco"
   CLOSE

   // Open a table without logging
   USE test DRIVER "DBFCDX"
   APPEND BLANK
   field->name := "Francesco"

RETURN

FUNCTION hb_LogRddInherit()
RETURN "DBFCDX"

Best regards,

Francesco

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to