                 # handle error
                 return false
 
-        log2 method + ' Request'
+        @log2 method + ' Request'
 
         req = http_protocol.request options, (res) ->
             body = ''
             res.setEncoding 'utf8'
             statusCode = res.statusCode
-            log2 'Status Code: ' + res.statusCode
+            @log2 'Status Code: ' + res.statusCode
             res.on 'data', (chunk) ->
                 body += chunk
             res.on 'end', ->

        return @_http_request uri, data, request_method, callback, binary_data_params

class SailthruClient
    ###
    By default enable logging
    ###
    @logging = true

    constructor: (@api_key, @api_secret, @api_url = false) ->
        @api_url = 'https://api.sailthru.com' if @api_url is false
        @request = new SailthruRequest


    log2 = (string) ->
        log string if @logging is true

    ###

###
class SailthruRequest

    @logging: true # By default enable logging
    @user_agent: 'Sailthru API Node/JavaScript Client'

    valid_methods = ['GET', 'POST', 'DELETE']

    log2: (string) ->
        log string if @logging is true

    _http_request: (uri, data, method, binary_data_params, callback) ->
        # support callback function as fourth arg
