Helper for :meth:`log_empty`, :meth:`log_text`, etc.
979641
def _do_log(self, client, _entry_class, payload=None, **kw):
        
        client = self._require_client(client)

        # Apply defaults
        kw["log_name"] = kw.pop("log_name", self.full_name)
        kw["labels"] = kw.pop("labels", self.labels)
        kw["resource"] = kw.pop("resource", _GLOBAL_RESOURCE)

        if payload is not None:
            entry = _entry_class(payload=payload, **kw)
        else:
            entry = _entry_class(**kw)

        api_repr = entry.to_api_repr()
        client.logging_api.write_entries([api_repr])
826474
def _write_to_log(self, s, truncate=False):
        """"""
        # if truncate is True, set write mode to truncate
        with open(self._logfile, 'w' if truncate else 'a') as fp:
            fp.writelines((to_text(s) if six.PY2 else to_text(s), ))
1044487
def v(msg, *args, **kwargs):

    '''
    
    '''

    return logging.log(VERBOSE, msg, *args, **kwargs)
1218001
def info(self, text=None):
        
        return self.stop_and_persist(symbol=LogSymbols.INFO.value, text=text)
149811
def _log(self, message, stream, color=None, newline=False):
        '''
        
        '''

        if color and self.color_term:
            colorend = Logger.COLOR_END
        else:
            color = colorend = ''

        stream.write('{color}{message}{colorend}\n'.format(
            color=color,
            message=message,
            colorend=colorend
        ))

        if newline:
            sys.stdout.write('\n')

        stream.flush()
1189439
def logv(msg, *args, **kwargs):
    
    if settings.VERBOSE:
        log(msg, *args, **kwargs)
1038595
def load_empty(cls, path:PathOrStr, fn:PathOrStr):
        ""
        return cls.load_state(path, pickle.load(open(Path(path)/fn, 'rb')))
1331589
def empty_bucket(outputs_file):
    """"""
    with open(outputs_file, "r") as f:
        outputs = yaml.load(f)

    bucket = outputs["storage"]["BucketName"]

    print("Emptying bucket {} ...".format(bucket))
    os.system("aws s3 rm s3://{} --recursive".format(bucket))
    print("Bucket {} has been emptied".format(bucket))
68031
def log_message(self, format, *args):
        
        self.log(format, args, logging.INFO)
1223358
def parse_logs(self, f):
        """"""
        data = {}
        for l in f.splitlines():
            # catch empty lines
            if len(l) == 0:
                continue
            s = l.split("\t")
            data_ = []
            # catch lines with descriptive content: "Of pairs used:"
            for i in s[1:]:
                if len(i) == 0:
                    continue
                try:
                    i.replace('(', '')
                    i.replace(')', '')
                    i.replace(',', '')

                    data_.append(float(i))
                except ValueError:
                    data_.append(i)
            if len(data_) == 0:
                continue
            if s[0].startswith('short range'):
                s[0] = 'short range'
            elif s[0].startswith('same fragment'):
                s[0] = 'same fragment'
            s[0] = s[0].capitalize()
            data[s[0]] = data_
        return data
72058
def _log (fun, msg, args, **kwargs):
    
    fun(msg, *args)
    if kwargs.get("traceback"):
        # note: get rid of last parts of the stack
        fun(_stack_format(inspect.stack()[2:]))
    if kwargs.get("exception"):
        fun(traceback.format_exc())
455762
def set_empty_text(self):
        
        self.buffer.insert_with_tags_by_name(
            self.buffer.get_start_iter(),
            self.empty_text, 'empty-text')
496829
def _log(self, num=None, format=None):
        '''
        
        '''

        num = '-n %s' % (num) if num else ''
        format = '--format="%s"' % (format) if format else ''
        return self.m(
            'getting git log',
            cmdd=dict(cmd='git log %s %s' % (num, format), cwd=self.local),
            verbose=False
        )
112927
def log(message, level="info"):
    
    now = time.time()
    entry = {}
    entry['level'] = level
    entry['message'] = message
    entry['timestamp'] = now
    _log_entries.append(entry)
870750
def _log(message):
        
        #  @todo Replace with log package.
        print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) + ' ' + str(message), flush=True)
1180309
def log_no_newline(self, msg):
      
      self.print2file(self.logfile, False, False, msg)
747376
def dump(self):
        

        # Print out the collectd feedback.
        # This is sent to stdout while other log messages are sent to stderr.
        for k, v in sorted(self._dict.items()):
            print(self.formatter(k, v))

        # Reset each entry to zero
        for k, v in sorted(self._dict.items()):
            self._dict[k] = 0