   NoRemoteData: 0
   NetworkError: 1
   NoChanges: 2
+
+$logger = -> ledger.utils.Logger.getLoggerByTag('SyncedStore')
+$info = (args...) -> $logger().info(args...)
 
 # A store able to synchronize with a remote crypted store. This store has an extra method in order to order a push or pull
 # operations

      @_auxiliaryStore.get ['__last_sync_md5', '__sync_changes'], (item) =>
        @_lastMd5 = item.__last_sync_md5
        @_changes = item['__sync_changes'].concat(@_changes) if item['__sync_changes']?
        @_unlockMethods()
        @throttled_pull()
        @debounced_push() if @_changes.length > 0

    # else
    # Overwrite local storage and keep changes
    @_getAllData().then (localData) =>
      $info 'Data before merge ', localData # TODO: Remove in production
      remoteHashes = (remoteData['__hashes'] or []).join(' ')
      localHashes = (localData['__hashes'] or []).join(' ').substr(0, 2 * 64 + 1)
      if remoteHashes.length is 0 or localHashes.length is 0
        # Remote data are not using the new format. Just update the current local storage
        $info 'Merge scenario 1', remoteHashes, localHashes
        @_setAllData(remoteData)
      else if (remoteHashes.indexOf(localHashes) >= (@HASHES_CHAIN_MAX_SIZE * 3 / 4) * (64 + 1)) or remoteHashes.indexOf(localHashes) is -1
        $info 'Merge scenario 2', remoteHashes, localHashes
        @_clearChanges()
        @_setAllData(remoteData)
      else if (localData['__hashes'] or []).join(' ').indexOf((remoteData['__hashes'] or []).join(' ').substr(0, 2 * 64 + 1)) != -1
        $info 'Merge scenario 3', remoteHashes, localHashes
        # We are up to date do nothing
        @_setAllData(remoteData)
      else
        [nextCommitHash, nextCommitData] = @_computeCommit(localData, @_changes)
        if _(remoteData['__hashes']).contains(nextCommitData)
          $info 'Merge scenario 4', remoteHashes, localHashes, nextCommitHash
          # The hash next commit already exists drop the changes
          @_setAllData(remoteData)
          @_clearChanges()
        else
          $info 'Merge scenario 5', remoteHashes, localHashes
          @_setAllData(remoteData)

  # @return A jQuery promise
