// ForceLog should rarely be used. It forceable logs an entry to the
// Windows Event Log (on Windows) or to the SysLog (on Linux)
176153
func ForceLog(level LogLevel, msg string) {
	var el eventType
	switch level {
	case LogError, LogFatal, LogPanic:
		el = elError
	case LogWarning:
		el = elWarning
	case LogInfo:
		el = elInfo
	}
	// We are logging it, ensure trailing newline
	if len(msg) == 0 || msg[len(msg)-1] != '\n' {
		msg += "\n" // Ensure trailing newline
	}
	reportEvent(el, 0, msg)
}
382404
func (f *MultiFilter) Log(keyvals ...interface{}) {
	if f.Disabled() {
		return
	}
	for _, filter := range f.Filters {
		if filter.WouldLog(keyvals...) {
			f.PassTo.Log(keyvals...)
			return
		}
	}
}
983440
func (ev *MigrateServedFrom) Syslog() (syslog.Priority, string) {
	var format string
	if ev.Reverse {
		format = "%s [migrate served-from %s/%s <- %s/%s] %s"
	} else {
		format = "%s [migrate served-from %s/%s -> %s/%s] %s"
	}
	return syslog.LOG_INFO, fmt.Sprintf(format,
		ev.KeyspaceName,
		ev.SourceShard.Keyspace(), ev.SourceShard.ShardName(),
		ev.DestinationShard.Keyspace(), ev.DestinationShard.ShardName(),
		ev.Status)
}
834368
func (c *Client) CreateSyslog(i *CreateSyslogInput) (*Syslog, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	path := fmt.Sprintf("/service/%s/version/%d/logging/syslog", i.Service, i.Version)
	resp, err := c.PostForm(path, i, nil)
	if err != nil {
		return nil, err
	}

	var s *Syslog
	if err := decodeJSON(&s, resp.Body); err != nil {
		return nil, err
	}
	return s, nil
}
1211457
func InitLog(params InitParams, ctx Context) (logger.Logger, error) {
	return InitLogWithPrefix(params, ctx, "kbfs", defaultLogPath(ctx))
}
1168164
func (h LevelFilterHandler) Log(r *Record) error {
	if r.Level == h.Level {
		return h.h.Log(r)
	}
	return nil
}
1139208
func (s *Syslog) Log(e log.Entry) {
	s.once.Do(func() {
		s.formatter = s.formatFunc(s)
	})
	line := string(s.formatter(e))

	switch e.Level {
	case log.DebugLevel:
		_ = s.writer.Debug(line)
	case log.InfoLevel:
		_ = s.writer.Info(line)
	case log.NoticeLevel:
		_ = s.writer.Notice(line)
	case log.WarnLevel:
		_ = s.writer.Warning(line)
	case log.ErrorLevel:
		_ = s.writer.Err(line)
	case log.PanicLevel, log.AlertLevel:
		_ = s.writer.Alert(line)
	case log.FatalLevel:
		_ = s.writer.Crit(line)
	}
}
631414
func (s *Scheme) Log(l conversion.DebugLogger) {
	s.converter.Debug = l
}
1307242
func (l SamplingEventLogger) Log(id EventID, e Event) {
	l.m.Lock()
	defer l.m.Unlock()

	r, ok := l.rootRates[id.Root]
	if !ok {
		r, ok = l.rates[e.Schema()]
	}

	if ok && r < l.r.Float64() {
		return
	}

	l.l.Log(id, e)
}
1195798
func (fsm *SimpleFSM) Logs() [][]byte {
	fsm.mu.Lock()
	defer fsm.mu.Unlock()
	copied := make([][]byte, len(fsm.logs))
	copy(copied, fsm.logs)
	return copied
}
689773
func (h *Handler) HandleLog(e *log.Entry) error {
	for _, handler := range h.Handlers {
		// TODO(tj): maybe just write to stderr here, definitely not ideal
		// to miss out logging to a more critical handler if something
		// goes wrong
		if err := handler.HandleLog(e); err != nil {
			return err
		}
	}

	return nil
}
908473
func (h *Handler) HandleLog(e *log.Entry) error {
	names := e.Fields.Names()

	h.mu.Lock()
	defer h.mu.Unlock()

	h.enc.EncodeKeyval("timestamp", e.Timestamp)
	h.enc.EncodeKeyval("level", e.Level.String())
	h.enc.EncodeKeyval("message", e.Message)

	for _, name := range names {
		h.enc.EncodeKeyval(name, e.Fields.Get(name))
	}

	h.enc.EndRecord()

	return nil
}
110886
func (l *LogAction) Log(level, format string, args ...interface{}) predicate.BoolPredicate {
	return func() bool {
		ilevel, err := log.ParseLevel(level)
		if err != nil {
			ilevel = log.DebugLevel
		}
		var writer io.Writer
		if l.writer != nil {
			writer = l.writer
		} else {
			writer = log.StandardLogger().WriterLevel(ilevel)
		}
		writer.Write([]byte(fmt.Sprintf(format, args...)))
		return true
	}
}
591104
func (tc *TabletChange) Syslog() (syslog.Priority, string) {
	return syslog.LOG_INFO, fmt.Sprintf("%s/%s/%s [tablet] %s",
		tc.Tablet.Keyspace, tc.Tablet.Shard, topoproto.TabletAliasString(tc.Tablet.Alias), tc.Status)
}
1218590
func (cl *Call) Log(arguments ...interface{}) {
	cl.scope.log(cl.entry, fmt.Sprintln(arguments...))
}
1338401
func (kc *KeyspaceChange) Syslog() (syslog.Priority, string) {
	return syslog.LOG_INFO, fmt.Sprintf("%s [keyspace] %s value: %s",
		kc.KeyspaceName, kc.Status, kc.Keyspace.String())
}
953829
func (c *CustomHandler) Log(e log.Entry) {

	// below prints to os.Stderr but could marshal to JSON
	// and send to central logging server
	//																						       ---------
	// 				                                                                 |----------> | console |
	//                                                                               |             ---------
	// i.e. -----------------               -----------------     Unmarshal    -------------       --------
	//     | app log handler | -- json --> | central log app | --    to    -> | log handler | --> | syslog |
	//      -----------------               -----------------       Entry      -------------       --------
	//      																         |             ---------
	//                                  									         |----------> | DataDog |
	//          																	        	   ---------
	b := new(bytes.Buffer)
	b.Reset()
	b.WriteString(e.Message)

	for _, f := range e.Fields {
		fmt.Fprintf(b, " %s=%v", f.Key, f.Value)
	}
	fmt.Println(b.String())
}