Exemplo n.º 1
0
def create_file_logger():
    global LOGGER_FILE
    LOGFILENAME = get_global_path('logfile.txt')
    LOGGER_FILE = FileLogger(LOGFILENAME,
                             name='file',
                             level=USERPREF['loglevel_file'])
    register(LOGGER_FILE)
Exemplo n.º 2
0
def test_file_logger():
    logfile = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                'log.txt')
    l = FileLogger(logfile, fmt='', level=logging.DEBUG, print_caller=False)
    l.debug("test file 1")
    l.debug("test file 2")
    l.close()
    
    with open(logfile, 'r') as f:
        contents = f.read()

    assert contents.strip().endswith("test file 1\ntest file 2")
    
    os.remove(logfile)
    
    
Exemplo n.º 3
0
 def initialize_logfile(self):
     # filename = self.filename_fet.replace('.fet.', '.kvwlg.')
     self.logfile = FileLogger(self.filename_kvwlg,
                               name='datafile',
                               level=self.userpref['loglevel_file'])
     # Register log file.
     register(self.logfile)
def test_file_logger():
    logfile = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                           'log.txt')
    l = FileLogger(logfile, fmt='', level=logging.DEBUG, print_caller=False)
    l.debug("test file 1")
    l.debug("test file 2")
    l.close()

    with open(logfile, 'r') as f:
        contents = f.read()

    assert contents.strip().endswith("test file 1\ntest file 2")

    os.remove(logfile)
Exemplo n.º 5
0
    def open_done(self):
        self.is_file_open = True
        self.setWindowTitle('KlustaViewa: {0:s}'.format(
            os.path.basename(self.loader.filename)
        ))

        register(FileLogger(self.loader.log_filename, name='kwik',
                 level=logging.INFO))

        # Start the selection buffer.
        self.buffer = Buffer(self,
            # delay_timer=.1, delay_buffer=.2
            delay_timer=USERPREF['delay_timer'],
            delay_buffer=USERPREF['delay_buffer']
            )
        self.buffer.start()
        self.buffer.accepted.connect(self.buffer_accepted_callback)

        # HACK: force release of Control key.
        self.force_key_release()
        clusters = self.get_view('ClusterView').selected_clusters()
        if clusters:
            self.get_view('ClusterView').unselect()

        # Create the Controller.
        self.controller = Controller(self.loader)
        # Create the cache for the cluster statistics that need to be
        # computed in the background.
        self.statscache = StatsCache(SETTINGS.get('correlograms.ncorrbins', NCORRBINS_DEFAULT))
        # Update stats cache in IPython view.
        ipython = self.get_view('IPythonView')
        if ipython:
            ipython.set_data(stats=self.statscache)

        # Initialize the wizard.
        self.wizard = Wizard()

        # Update the task graph.
        self.taskgraph.set(self)
        # self.taskgraph.update_projection_view()
        self.taskgraph.update_cluster_view()
        self.taskgraph.compute_similarity_matrix()
Exemplo n.º 6
0
 def initialize_logfile(self):
     self.logfile = FileLogger(self.filename_log,
                               name='datafile',
                               level=self.userpref['loglevel_file'])
     # Register log file.
     register(self.logfile)