// ListLoggers returns a map (loggerName => log level)
509938
func (lr *logRegistry) ListLoggers() map[string]string {
	list := make(map[string]string)

	var wasErr error

	lr.loggers.Range(func(k, v interface{}) bool {
		key, ok := k.(string)
		if !ok {
			wasErr = fmt.Errorf("cannot cast log map key to string")
			// false stops the iteration
			return false
		}
		value, ok := v.(*Logger)
		if !ok {
			wasErr = fmt.Errorf("cannot cast log value to Logger obj")
			return false
		}
		list[key] = value.GetLevel().String()
		return true
	})

	// throw panic outside of logger.Range()
	if wasErr != nil {
		panic(wasErr)
	}

	return list
}
1016348
func (c *CloudPersister) ListMaps() ([]*models.Map, error) {
	ctx := context.Background()
	Maps := make([]*models.Map, 0)
	q := datastore.NewQuery("Map")

	keys, err := c.DatastoreClient().GetAll(ctx, q, &Maps)

	if err != nil {
		return nil, fmt.Errorf("datastoredb: could not list Maps: %v", err)
	}

	for i, k := range keys {
		Maps[i].ID = k.ID()
	}

	return Maps, nil
}
1000372
func (m *MemoryStore) ListFiles() []string {
	names := make([]string, 0, len(m.data))
	for n := range m.data {
		names = append(names, n)
	}
	return names
}
595167
func (s *RPCServer) ListSources(arg ListSourcesIn, out *ListSourcesOut) error {
	ss, err := s.debugger.Sources(arg.Filter)
	if err != nil {
		return err
	}
	out.Sources = ss
	return nil
}
395494
func (api *API) ListLoadBalancers(zoneID string) ([]LoadBalancer, error) {
	uri := "/zones/" + zoneID + "/load_balancers"
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return nil, errors.Wrap(err, errMakeRequestError)
	}
	var r loadBalancerListResponse
	if err := json.Unmarshal(res, &r); err != nil {
		return nil, errors.Wrap(err, errUnmarshalError)
	}
	return r.Result, nil
}
567092
func GetLogger(name string) *Logger {
	logger, ok := loggers[name]
	if !ok {
		logger = &Logger{
			Name:  name,
			Level: DEBUG,
			ctx:   Ctx{},
		}

		logger.Enable(StdoutAppender())
		logger.normalizeName()

		// recalculate names
		curnamelen = len(logger.Name)
		for _, _logger := range loggers {
			_logger.normalizeName()
		}

		loggers[name] = logger
	}

	return logger
}
1117988
func (s *RouterService) ListRouters(p *ListRoutersParams) (*ListRoutersResponse, error) {
	resp, err := s.cs.newRequest("listRouters", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListRoutersResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
131656
func (c *client) ListPids(_ context.Context, _ string) ([]uint32, error) {
	return nil, errors.New("not implemented on Windows")
}
1265648
func Logger(system string) EventLogger {

	// TODO if we would like to adjust log levels at run-time. Store this event
	// logger in a map (just like the util.Logger impl)
	if len(system) == 0 {
		setuplog := getLogger("setup-logger")
		setuplog.Warning("Missing name parameter")
		system = "undefined"
	}

	logger := getLogger(system)

	return &eventLogger{system: system, StandardLogger: logger}
}
1012590
func (auth *Auth) ListUsers(maxResults int64) *ListAccountCursor {
	return &ListAccountCursor{MaxResults: maxResults, auth: auth}
}
1008586
func GetLoggerWithFields(ctx context.Context, fields map[interface{}]interface{}, keys ...interface{}) Logger {
	// must convert from interface{} -> interface{} to string -> interface{} for logrus.
	lfields := make(logrus.Fields, len(fields))
	for key, value := range fields {
		lfields[fmt.Sprint(key)] = value
	}

	return getLogrusLogger(ctx, keys...).WithFields(lfields)
}
71830
func (h *UserHandler) ListTrackers(ctx context.Context, arg keybase1.ListTrackersArg) ([]keybase1.Tracker, error) {
	eng := engine.NewListTrackers(h.G(), arg.Uid)
	return h.listTrackers(ctx, arg.SessionID, eng)
}
26058
func (h *UserHandler) ListTrackersByName(ctx context.Context, arg keybase1.ListTrackersByNameArg) ([]keybase1.Tracker, error) {
	eng := engine.NewListTrackersByName(arg.Username)
	return h.listTrackers(ctx, arg.SessionID, eng)
}
915841
func (c *Client) ListSyslogs(i *ListSyslogsInput) ([]*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.Get(path, nil)
	if err != nil {
		return nil, err
	}

	var ss []*Syslog
	if err := decodeJSON(&ss, resp.Body); err != nil {
		return nil, err
	}
	sort.Stable(syslogsByName(ss))
	return ss, nil
}
711675
func SortLogger(outputLogger log.Logger, keys ...string) log.Logger {
	indices := make(map[string]int, len(keys))
	for i, k := range keys {
		indices[k] = i
	}
	return log.LoggerFunc(func(keyvals ...interface{}) error {
		sortKeyvals(indices, keyvals)
		return outputLogger.Log(keyvals...)
	})
}
1342726
func (api *API) ListLoadBalancerMonitors() ([]LoadBalancerMonitor, error) {
	uri := api.userBaseURL("/user") + "/load_balancers/monitors"
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return nil, errors.Wrap(err, errMakeRequestError)
	}
	var r loadBalancerMonitorListResponse
	if err := json.Unmarshal(res, &r); err != nil {
		return nil, errors.Wrap(err, errUnmarshalError)
	}
	return r.Result, nil
}
873619
func (s *RPCServer) ListRegisters(arg ListRegistersIn, out *ListRegistersOut) error {
	if arg.ThreadID == 0 {
		state, err := s.debugger.State(false)
		if err != nil {
			return err
		}
		arg.ThreadID = state.CurrentThread.ID
	}

	regs, err := s.debugger.Registers(arg.ThreadID, arg.IncludeFp)
	if err != nil {
		return err
	}
	out.Regs = regs
	out.Registers = out.Regs.String()

	return nil
}