def __init__(self, database_file_path, on_create=None, apikey=None, onsync=None, onsyncfail=None, syncraise=False):
self.database = apsw.Connection(database_file_path)<EOL>c = self.database.cursor()<EOL>c.execute(<EOL>"<STR_LIT>")<EOL>c.execute(<EOL>"<STR_LIT>")<EOL>c.execute(<EOL>"<STR_LIT>")<EOL>c.execute("<STR_LIT>")<EOL>row_number = next(c)[<NUM_LIT:0>]<EOL>if row_number == <NUM_LIT:0>:<EOL><INDENT>logging.debug("<STR_LIT>")<EOL>c.execute("<STR_LIT>",<EOL>(CONNECTORDB_URL, ))<EOL><DEDENT>c.execute(<EOL>"<STR_LIT>")<EOL>self.__apikey, self.__serverurl, self.__lastsync, self.__syncperiod = next(<EOL>c)<EOL>c.execute("<STR_LIT>")<EOL>self.streams = {}<EOL>for row in c.fetchall():<EOL><INDENT>self.streams[row[<NUM_LIT:0>]] = json.loads(row[<NUM_LIT:1>])<EOL><DEDENT>if apikey is not None:<EOL><INDENT>self.apikey = apikey<EOL><DEDENT>self.synclock = threading.Lock()<EOL>self.syncthread = None<EOL>self.__cdb = None<EOL>self.onsync = onsync<EOL>self.onsyncfail = onsyncfail<EOL>self.syncraise = syncraise<EOL>if on_create is not None and row_number == <NUM_LIT:0>:<EOL><INDENT>try:<EOL><INDENT>if False == on_create(self):<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>except:<EOL><INDENT>self.database.close()<EOL>os.remove(database_file_path)<EOL>raise<EOL><DEDENT><DEDENT>
Logger is started by passing its database file, and an optional callback which is run if the database
        is not initialized, allowing setup code to be only run once.

        The on_create callback can optionally be used to initialize the necessary api keys and such.
        If on_create returns False or raises an error, the uninitialized database file will be removed.