def start_durus(host, port, logfilename, dbfilename): logfile = open(logfilename, 'a+') direct_output(logfile) logger.setLevel(9) storage = FileStorage(dbfilename, repair=False, readonly=False) log(20, 'Storage file=%s host=%s port=%s', storage.get_filename(), host, port) StorageServer(storage, host=host, port=port).serve()
def startDurus(host, port, logfilename, dbfilename): """Start and initialize the Durus server component. Also opens a log file. """ lf = logfile.open(logfilename, 50000) direct_output(lf) logger.setLevel(9) storage = FileStorage(dbfilename, repair=False, readonly=False) log(20, 'Storage file=%s host=%s port=%s', storage.get_filename(), host, port) StorageServer(storage, host=host, port=port).serve()
def start_durus(logfile, logginglevel, address, storage, gcbytes): if logfile is None: logfile = sys.stderr else: logfile = open(logfile, 'a+') direct_output(logfile) logger.setLevel(logginglevel) socket_address = SocketAddress.new(address) if hasattr(storage, 'get_filename'): log(20, 'Storage file=%s address=%s', storage.get_filename(), socket_address) StorageServer(storage, address=socket_address, gcbytes=gcbytes).serve()
def import_durus(): old_stdout = sys.stdout old_stderr = sys.stderr sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ from durus import logger logger.direct_output(open(paths.data_path('durus.log'), 'w')) sys.stdout = old_stdout sys.stderr = old_stderr from durus.file_storage import FileStorage from durus.connection import Connection return (FileStorage, Connection)
def start_durus(host, port, logfilename, dbfilename): logfile = open(logfilename, 'a+') direct_output(logfile) logger.setLevel(9) storage = FileStorage(dbfilename, repair=False, readonly=False) """ In Durus 2.6, there was a fp.name member data. However it doesn't exist in Durus 2.7. However, in both 2.6 and 2.7, there is a get_filename() method that will work. #log(20, 'Storage file=%s host=%s port=%s', storage.fp.name, host, port) """ log(20, 'Storage file=%s host=%s port=%s',storage.get_filename(), host, port) StorageServer(storage, host=host, port=port).serve()
def start_durus(logfile, logginglevel, file, repair, readonly, host, port): if logfile is None: logfile = sys.stderr else: logfile = open(logfile, 'a+') direct_output(logfile) logger.setLevel(logginglevel) if file is None: storage = TempFileStorage() else: storage = FileStorage(file, repair=repair, readonly=readonly) log(20, 'Storage file=%s host=%s port=%s', storage.fp.name, host, port) StorageServer(storage, host=host, port=port).serve()
def _pre(self): direct_output(sys.stdout)
def setup(self): direct_output(sys.stdout)