I want to create some logging, and i made a class. However i have some problem with passing the arguments to it.

Class: 

```
namespace debug
{
    class log
    {
        private:    // Members
            const std::string context;
            int Type;
        public:     // Methods
            void message( int Type, const std::string& message, ... );

        public:     // Constructor, Destructor
            log( const std::string& context, int Type );
            ~log();
    };//class log
}//namespace debug     

namespace debug
{
    void log::message( int Type, const std::string& message, ... )
    {
        va_list args;
        int len;

        char    *buffer;

        va_start( args, message );

        len = _vscprintf( message.c_str(), args ) + 1; // _vscprintf doesn't count terminating '\0'
        buffer = ( char* )malloc( len * sizeof( char ) );

        vsprintf_s( buffer, len, message.c_str(), args );

        va_end( args );

    }//log::message
}//namespace debug

```

I have two macros defined: 

```
#define DEBUG_METHOD( Type )  debug::log _debugLog( __FUNCTION__, Type );
#define DEBUG_MESSAGE( Type, debug_message, ... ) { _debugLog.message( Type, debug_message, ##__VA_ARGS__ ); }

```

And i use them in a Function like this:

```
BOOL test( BOOL *bTestVal)
{
   DEBUG_METHOD( INFO );
   DEBUG_MESSAGE( INFO, "Argument1 = '%s'", BoolToString( ( BOOL )*bTestVal) );

       //here comes some work...
}

```

Unfortunately i always get an error. This line `len = _vscprintf( message.c_str(), args ) + 1;` always throws an error. I think `va_start` is causing this, becasue `args` has a value of `+ args 0x0052eed8 "ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ... char *`

Could someone please help me what i am doing wrong?

Thanks in advance!