Log start, end, and duration.
487132
def timing(name=''):
  """"""
  start = datetime.datetime.now()
  timestamp = start.strftime('%H:%M')
  tf.logging.info('Starting job [%s] at %s', name, timestamp)
  yield
  end = datetime.datetime.now()
  timestamp = end.strftime('%H:%M')
  tf.logging.info('Finished job [%s] at %s', name, timestamp)
  duration = end - start
  duration_mins = duration.total_seconds() / 60
  tf.logging.info('Total time [%s] (m): %d', name, int(duration_mins))
1135419
def log_stop(self, start):
        """"""
        if not logger.isEnabledFor(logging.INFO): return

        stop = time.time()
        get_elapsed = lambda start, stop, multiplier, rnd: round(abs(stop - start) * float(multiplier), rnd)
        elapsed = get_elapsed(start, stop, 1000.00, 1)
        total = "%0.1f ms" % (elapsed)
        logger.info("RESPONSE {} {} in {}".format(self.response.code, self.response.status, total))
433528
def createSummary(self, log):
        
        warnings = self.obs.warnings
        errors = []
        if warnings:
            self.addCompleteLog('%d Warnings' % len(warnings), "\n".join(warnings))
        if errors:
            self.addCompleteLog('%d Errors' % len(errors), "\n".join(errors))
569132
def log(level, data)
      tmp = Time.now.strftime(@time_format)
      tmp << " " << data
      super(level, tmp)
    end
175330
def start(self):
        """"""

        if self.log_filename:
            print('Output will be logged to `%s`.' % self.log_filename)

        start_time = time.strftime(self.timestamp_fmt)
        print('Started %s' % start_time)

        if self.log_filename:
            orig_stdout = sys.stdout
            orig_stderr = sys.stderr

            sys.stdout = self.log_file
            sys.stderr = self.log_file

            print('Started %s' % start_time)

        doit_main = DoitMain(self)
        doit_main.run(['run'])

        stop_time = time.strftime(self.timestamp_fmt)

        if self.log_filename:
            print('Stopped %s' % stop_time)
            print()

            sys.stdout = orig_stdout
            sys.stderr = orig_stderr
            self.log_file.close()

        print('Stopped %s' % stop_time)
1192928
def log_end(path, log_file, sum_time):
    
    with open(path + log_file, "a") as log:
        log.seek(2)
        log.write("#" * 79 + "\n\n")
        log.write("Time : " + time.strftime("%H:%M:%S") + "\n")
        log.write("Total build time : {0}\n".format(sum_time))
        log.write(" " * 38 + "E N D\n\n")
        log.write("#" * 79 + "\n\n")
        log.close()
1018993
def check_and_format_logs_params(start, end, tail):
    """"""
    def _decode_duration_type(duration_type):
        durations = {'m': 'minutes', 'h': 'hours', 'd': 'days', 'w': 'weeks'}
        return durations[duration_type]

    if not start:
        if tail:
            start_dt = maya.now().subtract(seconds=300).datetime(naive=True)
        else:
            start_dt = maya.now().subtract(days=1).datetime(naive=True)
    elif start and start[-1] in ['m', 'h', 'd', 'w']:
        value = int(start[:-1])
        start_dt = maya.now().subtract(
            **{_decode_duration_type(start[-1]): value}).datetime(naive=True)
    elif start:
        start_dt = maya.parse(start).datetime(naive=True)

    if end and end[-1] in ['m', 'h', 'd', 'w']:
        value = int(end[:-1])
        end_dt = maya.now().subtract(
            **{_decode_duration_type(end[-1]): value}).datetime(naive=True)
    elif end:
        end_dt = maya.parse(end).datetime(naive=True)
    else:
        end_dt = None
    return start_dt, end_dt
819548
def log(self, *lines):
        """"""
        if getattr(self, "debug", False):
            print(dt.datetime.now().time(), end=' ')
            for line in lines:
                print(line, end=' ')
            print()
371211
def log_time(func: Callable[..., Any]) -> Callable[..., Any]:
    

    def wrapper(*args, **kwargs):
        start_time = time.time()
        log.info("%s starting...", func.__name__.title())
        ret = func(*args, **kwargs)
        log.info(
            "%s finished (%s)",
            func.__name__.title(),
            datetime.timedelta(seconds=int(time.time() - start_time)),
        )
        return ret

    return wrapper
943115
def _duration(start, end):
    
    if start and end:
        if start > end:
            return None
        else:
            return end - start
    elif start:
        return time.time() - start
    else:
        return None
1140494
def init_logs(args, tool="NanoPlot"):
    """"""
    start_time = dt.fromtimestamp(time()).strftime('%Y%m%d_%H%M')
    logname = os.path.join(args.outdir, args.prefix + tool + "_" + start_time + ".log")
    handlers = [logging.FileHandler(logname)]
    if args.verbose:
        handlers.append(logging.StreamHandler())
    logging.basicConfig(
        format='%(asctime)s %(message)s',
        handlers=handlers,
        level=logging.INFO)
    logging.info('{} {} started with arguments {}'.format(tool, __version__, args))
    logging.info('Python version is: {}'.format(sys.version.replace('\n', ' ')))
    return logname
1168839
def _timing(f, logs_every=100):
  """"""
  @functools.wraps(f)
  def wrap(*args, **kw):
    """The timer function."""
    ts = _time.time()
    result = f(*args, **kw)
    te = _time.time()
    qj._call_counts[f] += 1
    qj._timings[f] += (te - ts)
    count = qj._call_counts[f]
    if count % logs_every == 0:
      qj(x='%2.4f seconds' % (qj._timings[f] / count),
         s='Average timing for %s across %d call%s' % (f, count, '' if count == 1 else 's'), _depth=2)
    return result
  return wrap
175734
def log_entries_in_range(entries, start, end):
    ''''''
    start = _timestamp_from_string(start)
    end = _timestamp_from_string(end)
    for entry in entries:
        log_timestamp = entry.get('timestamp', 0)
        if log_timestamp >= start and log_timestamp <= end:
            yield entry
996135
def log_end_message(log):
    
    if not log in MESSAGE_LOG.keys():
        log = -1

    res = colors.color_text(*MESSAGE_LOG[log][1])

    sys.stdout.write("\r[" + res + "] " + MESSAGE + "\n")
283477
public void logStarted() {
    if (disableHistory) {
      return;
    }

    if (null != writers) {
      log(writers, RecordTypes.Job,
          new Keys[] {Keys.JOBID, Keys.JOB_STATUS},
          new String[] {jobId.toString(),
                        Values.RUNNING.name()});
    }
  }
891001
protected function end_log() {
        if (!$this->progress) {
            return;
        }
        echo get_string('done', 'tool_generator', round(microtime(true) - $this->starttime, 1));
        if (CLI_SCRIPT) {
            echo "\n";
        } else {
            echo html_writer::end_tag('li');
        }
    }
179288
function Logger(manager, source) {
        Object.defineProperties(this, {
            "manager" : {
                value : manager,
                writable : false,
                enumerable : true
            },
            "source" : {
                value : source,
                writable : false,
                enumerable : true
            },
            "_timerData" : {
                value : {},
                writable : false,
                enumerable : false
            }
        });
    }