// Determine if the specified record is to be logged.
// Is the specified record to be logged? Returns false for no, true for yes.
// If deemed appropriate, the record may be modified in-place.
768611
func (self *NameFilter) Filter(record *LogRecord) bool {
	length := len(self.name)
	if length == 0 {
		return true
	} else if self.name == record.Name {
		return true
	} else if !strings.HasPrefix(record.Name, self.name) {
		return false
	}
	return (record.Name[length] == '.')
}
397267
func IsRegistered(user, pass string) (*models.Principal, error) {
	if password, ok := userDb[user]; ok {
		if pass == password {
			return &models.Principal{
				Name: user,
			}, nil
		}
	}
	return nil, errors.New(401, "Unauthorized: not a registered user")
}
1294528
func (c remoteHandler) Log(record *Record) error {
	return c(record.Message, record.Time, record.Level, record.Call, record.Context)
}
198670
func (tt *timeTracker) Record(target *querypb.Target) time.Time {
	tt.mu.Lock()
	defer tt.mu.Unlock()
	last, ok := tt.timestamps[target]
	if !ok {
		last = time.Now()
		tt.timestamps[target] = last
	}
	return last
}
255558
func (q *Query) log(start time.Time, execute bool) {
	if q.LogFunc == nil && q.PerfFunc == nil {
		return
	}
	ns := time.Now().Sub(start).Nanoseconds()
	s := q.logSQL()
	if q.LogFunc != nil {
		if execute {
			q.LogFunc("[%.2fms] Execute SQL: %v", float64(ns)/1e6, s)
		} else {
			q.LogFunc("[%.2fms] Query SQL: %v", float64(ns)/1e6, s)
		}
	}
	if q.PerfFunc != nil {
		q.PerfFunc(ns, s, execute)
	}
}
165047
func IsLogging(c context.Context, l Level) bool {
	return l >= GetLevel(c)
}
793868
func (c *ReferenceCollection) HasLog(name string) (bool, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_reference_has_log(c.repo.ptr, cname)
	runtime.KeepAlive(c)
	if ret < 0 {
		return false, MakeGitError(ret)
	}

	return ret == 1, nil
}
661009
func (r *AccessLogRecord) getRecord() []byte {
	if len(r.record) == 0 {
		r.record = r.makeRecord()
	}

	return r.record
}
675050
func (l LevelInfo) ShouldLog(m message.Composer) bool {
	// priorities are 0 = Emergency; 7 = debug
	return m.Loggable() && (m.Priority() >= l.Threshold)
}
381545
func CheckRecordID(recordID string) error {
	recordIDParts := strings.SplitN(recordID, "/", 2)
	if len(recordIDParts) < 2 || recordIDParts[0] == "" || recordIDParts[1] == "" {
		return errors.New("Error: Record ID not in correct format.")
	}
	return nil
}
558126
func (lr *LogRecord) Log() {
	flowdebug.Log(lr.getLogFields(), "Logging flow record")

	// Lock while writing access log so we serialize writes as we may have
	// to reopen the logfile and parallel writes could fail because of that
	logMutex.Lock()
	defer logMutex.Unlock()

	lr.Metadata = metadata

	if notifier != nil {
		notifier.NewProxyLogRecord(lr)
	}

	if logger == nil {
		flowdebug.Log(log.WithField(FieldFilePath, logPath),
			"Skipping writing to access log (logger nil)")
		return
	}

	if _, err := logger.Write(lr.getRawLogMessage()); err != nil {
		log.WithError(err).WithField(FieldFilePath, logPath).
			Errorf("Error writing to access file")
	}
}
1135862
func (res *Resolver) records() *records.RecordGenerator {
	res.rsLock.RLock()
	defer res.rsLock.RUnlock()
	return res.rs
}
1260492
func (m *Monitor) Record(conditions ...Condition) {
	if len(conditions) == 0 {
		return
	}
	m.lock.Lock()
	defer m.lock.Unlock()
	t := time.Now().UTC()
	for _, condition := range conditions {
		m.events = append(m.events, &Event{
			At:        t,
			Condition: condition,
		})
	}
}
853847
func (b *RawElementData) SetRecorded(value interface{}) {
	b.recorded = value
	b.recordedSet = true
}
1191638
func (c *ConvenientClient) GetRecordID(record *Record) error {
	finalID := ""
	url := fmt.Sprintf("AllRecord/%s/%s", record.Zone, record.FQDN)
	var records AllRecordsResponse
	err := c.Do("GET", url, nil, &records)
	if err != nil {
		return fmt.Errorf("Failed to find Dyn record id: %s", err)
	}
	for _, recordURL := range records.Data {
		id := strings.TrimPrefix(recordURL, fmt.Sprintf("/REST/%sRecord/%s/%s/", record.Type, record.Zone, record.FQDN))
		if !strings.Contains(id, "/") && id != "" {
			finalID = id
			log.Printf("[INFO] Found Dyn record ID: %s", id)
		}
	}
	if finalID == "" {
		return fmt.Errorf("Failed to find Dyn record id!")
	}

	record.ID = finalID
	return nil
}
1176804
func (l *intLogger) IsDebug() bool {
	return Level(atomic.LoadInt32(l.level)) <= Debug
}
1156587
func (c *Client) OnRequestLog(rl func(*RequestLog) error) *Client {
	if c.requestLog != nil {
		c.Log.Printf("Overwriting an existing on-request-log callback from=%s to=%s", functionName(c.requestLog), functionName(rl))
	}
	c.requestLog = rl
	return c
}