 
   @getScheduledMails: ->
     user = @getEmail()
-    Logger.log 'Get scheduled mails for %s', user
+    MailButler.log "Get scheduled mails for #{user}"
     result = @DB.getMails user, null, null, false
     result.next() while result.hasNext()
 
   @processButlerMails: (d) ->
-    Logger.log "Checking for scheduled mails on %s", d
+    MailButler.log "Checking for scheduled mails on #{d.toUTCString()}"
 
     user = @getEmail()
     time = d.getTime()
-    Logger.log "With user '%s', version '%s' and time %s", user, @VERSION, time
+    MailButler.log "With user '#{user}', version '#{@VERSION}' and time #{time}"
     result = @DB.getMails user, @VERSION, time, false
 
     if (s = result.getSize()) > 0
       # yep there are some
-      Logger.log "... found %s candidates", s
+      MailButler.log "... found #{s} candidates"
 
       while result.hasNext()
         @processButlerMail result.next(), time
 
     else
       # No scheduled messages available
-      Logger.log "... none found."
+      MailButler.log "... none found."
     return
 
   @processButlerMail: (props, time) ->
-    Logger.log "Process mail with props: %s", props
+    MailButler.log "Process mail with props: #{JSON.stringify(props)}"
 
     messageId = props.messageId
     message = GmailApp.getMessageById messageId if messageId
 
     unless message
       # Message does not exist or is invalid
-      Logger.log "Message with ID '%s' does not exist or is invalid", messageId
+      MailButler.log "Message with ID '#{messageId}' does not exist or is invalid"
 
       # Set the status
       props.status = ProcessingStatus.NOT_FOUND

  try
    if lock.tryLock 10000
      # wait 10 seconds at most
      Logger.log 'We have the lock...'
      try
        if MailButler.isEnabled()
              # Get the time this scheduled execution started


  @setup: ->
    if ScriptApp.getScriptTriggers().length is 0
      MailButler.log "Installing trigger"
      ScriptApp.newTrigger("process").timeBased().everyMinutes(MailButler.FREQUENCY_MINUTES).create()

    email = @getEmail()
    MailButler.log 'Setting version'
    @DB.setCurrentVersion email, @VERSION
    MailButler.log 'Setting last used date'
    @DB.setLastUsed email
    return

