# Path: lacli/log.py
# def getLogger(logger='lacli'):
#     return lacore.log.getLogger(logger)


import os
import multiprocessing
from progressbar import (ProgressBar, Bar,
                         ETA, FileTransferSpeed)
from lacli.log import getLogger
from abc import ABCMeta, abstractmethod
from logutils.queue import QueueListener
            self.keydone(msg)
            self.save_current()

    def __enter__(self):
        q = super(BaseProgressHandler, self).__enter__()
        progressToQueue(q)
        self.start(initval=self.progress)
        return q

    @abstractmethod
    def keydone(self, msg):
        getLogger().debug("saved key: {key} ({size})".format(msg))


class StateProgressHandler(BaseProgressHandler):
    uploads = {}

    def __init__(self, state=None, **kwargs):
        assert state is not None, \
            "StateProgressHandler requires a state object"
        self.state = state
        progress = kwargs.pop('progress', 0)
        for seq, key in enumerate(self.state.keys):
            progress += key['size']
        kwargs['progress'] = progress
        super(StateProgressHandler, self).__init__(**kwargs)

    def update(self, value=None):
        if value is not None:
            self.state.update(value)

# Path: lacli/log.py
# def getLogger(logger='lacli'):
#     return lacore.log.getLogger(logger)


# Path: lacli/progress.py
import os
import multiprocessing
from progressbar import (ProgressBar, Bar,
                         ETA, FileTransferSpeed)
from lacli.log import getLogger
from abc import ABCMeta, abstractmethod
from logutils.queue import QueueListener

            self.keydone(msg)
            self.save_current()

    def __enter__(self):
        q = super(BaseProgressHandler, self).__enter__()
        progressToQueue(q)
        self.start(initval=self.progress)
        return q

    @abstractmethod
    def keydone(self, msg):
        getLogger().debug("saved key: {key} ({size})".format(msg))


class StateProgressHandler(BaseProgressHandler):
    uploads = {}

    def __init__(self, state=None, **kwargs):
        assert state is not None, \
            "StateProgressHandler requires a state object"
        self.state = state
        progress = kwargs.pop('progress', 0)
        for seq, key in enumerate(self.state.keys):
            progress += key['size']
        kwargs['progress'] = progress
        super(StateProgressHandler, self).__init__(**kwargs)

    def update(self, value=None):
        if value is not None:
            self.state.update(value)

        super(StateProgressHandler, self).update(value)