/**
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 *
 * The iWear Framework is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation as in version 2 of the License.

 * 
 * The iWear Framework is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __IWEAR_DB_DEBUGMODULEDB_H
#define __IWEAR_DB_DEBUGMODULEDB_H

#include "iwear/debugmodule.h"
#include "iwear/db/db.h"

namespace iwear
{
    namespace db
    {
class debugmoduledb : public debugmodule
{
private:
protected:
   /**
    * The Database connection we dump to (assuming its already connected)
    */
    db& dbcon;

   /**
    * The table to log the data to.
    * @note The table must accept the data in the column specified through the
    * column string to be the only data inserted into the table. So the table
    * should consist only of a auto-inserted time and a debug string column.
    */
    string table;

   /**
    * The Column to write the data to.
    */
    string column;

   /**
    * This is the maximum data length the Table will accept. If within a log()
    * call the string is longer than that, it will automatically be wrapped.
    */
    uint32_t maxlen;
public:
    debugmoduledb( db& _db, debugmanager& dman, const string& tablename, const string& columnname, uint32_t _maxlen = 512 );
    virtual ~debugmoduledb();
    virtual int log( const char * msg );
};

}
}

#endif
