     Application.all (err, apps) ->
         if err
             log.error "Error when checking apps versions:"
-            console.log err
+            log.raw err
         else
             for app in apps
                 checkUpdate notifier, app
 
 
+# Start check update cron.
 module.exports = ->
     checkUpdates()
     setInterval checkUpdates, TIME_BETWEEN_UPDATE_CHECKS

TIME_BETWEEN_UPDATE_CHECKS = 1000 * 60 * 60 * 24 # once a day


checkUpdate = (notifier, app) ->
    log.info "#{app.name} - checking for an update..."
    app.checkForUpdate (err, setUpdate) ->
        log.debug "#{app.version}"
        if err?
            log.error "#{app.name} - Error while checking update."
            console.log err
        else if setUpdate
            log.info "#{app.name} - update required."
            notifier.createTemporary

# This initializer aims to check
NotificationsHelper = require 'cozy-notifications-helper'
log = require('printit')
    prefix: 'application updates'
