打印或写日志
        :params message: 要打印或要写的日志
6301
def log(self, message):
        
        theLog = '[日志名:%s] [时间:%s] \n[内容:\n%s]\n\n' % (
                self.startName, timestamp_to_time(get_current_timestamp()),  message)
        if not self.fileName:
            print(theLog)
        else:
            # 由于这里有很多的线程都要经过这道线程锁的控制，所以不会出现问题
            self.check_log_file_size()
            self.__f.write(theLog)
938638
def _log(self, message):
        
        self._logger.debug("{}: {}".format(self.name, message))
1038215
def log(type, message)
      case type.to_sym
      when :info
        msg = message
      when :error
        msg = message
      end

      @messages << msg
      puts msg if verbose?
    end
171819
def _log_to_file(self, etype, source, msg='', target='', hostmask='', params=''):
        
        today = datetime.utcnow()
        # TODO: Use self.locale['timezone'] for changing time
        date = today.strftime(self.locale['date_fmt'])
        time = today.strftime(self.locale['time_fmt'])
        datetime_s = today.strftime(self.locale['short_datetime_fmt'])
        datetime_l = today.strftime(self.locale['long_datetime_fmt'])
        
        if target == self.nickname and etype in ('privmsg', 'action'):
            target = source

        if etype in self.log_formats:
            file_path = os.path.expanduser(self.log_file.format(**locals()))
            file_dir = os.path.dirname(file_path)
            if not os.path.isdir(file_dir):
                os.makedirs(file_dir)

            line = self.log_formats[etype].format(**locals())
            with open(file_path, 'a') as log:
                log.write(line+'\n')
836606
def logged_timer(message):
    ""
    tick = time.time()
    yield
    tock = time.time()
    logging.info("%s: %.3f seconds", message, (tock - tick))
930887
function (loggerName, level, message) {
    this.time = new Date();
    this.loggerName = loggerName;
    this.level = level;
    this.message = message;
  }
93716
function log(conn, name, message) {
    if (! show_sql) {
        return;
    }
    function padding(n, len) {
        var
            s = n.toString(),
            p = len - s.length;
        while (p > 0) {
            s = '0' + s;
            p--;
        }
        return s;
    }
    var
        d = new Date(),
        h = d.getHours(),
        m = d.getMinutes(),
        s = d.getSeconds(),
        ms = d.getMilliseconds(),
        date = padding(h, 2) + ':' + padding(m, 2) + ':' + padding(s, 2) + '.' + padding(ms, 3);
    console.log(date + (conn ? (' [Warp@' + conn.__objectId + '] ') : ' ') + name + ': ' + message);
}
538550
def log(event = nil, timestamp = Time.now, **fields)
      ts = ::Instana::Util.time_to_ms(timestamp).to_s
      if custom?
        @data[:data][:sdk][:custom][:logs][ts] = fields
        @data[:data][:sdk][:custom][:logs][ts][:event] = event
      else
        set_tags(:log => fields)
      end
    rescue StandardError => e
      Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
    end
668184
def error(self, message, *args, **kwargs):
        
        self._log(logging.ERROR, message, *args, **kwargs)
547866
def log_event(self, message, timestamp=None):
        

        if not message: # if empty or None
            logger.debug("ASCWriter: ignoring empty message")
            return

        # this is the case for the very first message:
        if not self.header_written:
            self.last_timestamp = (timestamp or 0.0)
            self.started = self.last_timestamp
            mlsec = repr(self.last_timestamp).split('.')[1][:3]
            formatted_date = time.strftime(self.FORMAT_DATE.format(mlsec), time.localtime(self.last_timestamp))
            self.file.write("Begin Triggerblock %s\n" % formatted_date)
            self.header_written = True
            self.log_event("Start of measurement") # caution: this is a recursive call!

        # Use last known timestamp if unknown
        if timestamp is None:
            timestamp = self.last_timestamp

        # turn into relative timestamps if necessary
        if timestamp >= self.started:
            timestamp -= self.started

        line = self.FORMAT_EVENT.format(timestamp=timestamp, message=message)
        self.file.write(line)
157899
def log(duration, message=None, use_last_commit_message=False):
    
    branch = git.branch
    issue = jira.get_issue(branch)
    # Create the comment
    comment = "Working on issue %s" % branch
    if message:
        comment = message
    elif use_last_commit_message:
        comment = git.get_last_commit_message()

    if issue:
        # If the duration is provided use it, otherwise use the elapsed time since the last mark
        duration = jira.get_elapsed_time(issue) if duration == '.' else duration

        if duration:
            # Add the worklog
            jira.add_worklog(issue, timeSpent=duration, adjustEstimate=None, newEstimate=None, reduceBy=None,
                             comment=comment)

            print "Logged %s against issue %s (%s)" % (duration, branch, comment)
        else:
            print "No time logged, less than 0m elapsed."
237039
def log(self, message, level=LOG_INFO):
        
        assert level in [
            self.LOG_ERROR,
            self.LOG_INFO,
            self.LOG_WARNING,
        ], "level must be LOG_ERROR, LOG_INFO or LOG_WARNING"

        # nicely format logs if we can using pretty print
        if isinstance(message, (dict, list, set, tuple)):
            message = pformat(message)
        # start on new line if multi-line output
        try:
            if "\n" in message:
                message = "\n" + message
        except:  # noqa e722
            pass
        message = "Module `{}`: {}".format(self._module.module_full_name, message)
        self._py3_wrapper.log(message, level)
1207353
def log(self, message, type='notice'):
        
        if self.logger and not callable(self.logger):
            raise ValueError(u"Invalid logger set, must be a callable")
        if self.verbose and self.logger:
            self.logger(message, type)
1310757
function logMessage (message) {
  if (!process.send) {
    console.log(message)
  } else {
    process.send(message)
  }
}
436881
def write(self, message, cur_time=None):
        
        if cur_time is None:
            cur_time = time.time()
        lines = self._line_buffer.add_string(message)
        for line in lines:
            #print('ts line', repr(line))
            timestamp = ''
            if self._prepend_timestamp:
                timestamp = datetime.datetime.utcfromtimestamp(
                    cur_time).isoformat() + ' '
            line = u'{}{}{}'.format(self._line_prepend, timestamp, line)
            self._fsapi.push(self._filename, line)
726118
def log(fname,msg):
    '''  '''
    with open(fname,'a') as f:
        f.write(datetime.datetime.now().strftime('%m-%d-%Y %H:%M:\n') + msg + '\n')
835274
def log(message)
      if verbose
        puts "*** #{message}"
      elsif very_verbose
        time = Time.now.strftime('%H:%M:%S %Y-%m-%d')
        puts "** [#{time}] #$$: #{message}"
      end
    end