ui/logs.go
func (h *Handler) GetLogs(tkn string, levels []string, searchText,
	dateFrom, dateTo string, offset, limit uint) (*GetLogsResult, error) {
	logger := h.logger.Add("method", "GetLogs", "searchText",
		searchText, "levels", levels, "dateFrom", dateFrom, "dateTo",
		dateTo, "offset", offset, "limit", limit)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return nil, ErrAccessDenied
	}

	args := &getLogsArgs{
		level:      levels,
		dateTo:     dateTo,
		dateFrom:   dateFrom,
		searchText: searchText,
	}

	conditions, arguments := h.getLogsConditions(args)
	totalItems, err := h.getTotalLogEvents(logger, conditions, arguments)
	if err != nil {
		return nil, err
	}

	result, err := h.getLogs(logger, conditions, arguments, offset, limit)
	if err != nil {
		return nil, err
	}

	return &GetLogsResult{result, totalItems}, err
}
func (h *Handler) GetLogs(tkn string, levels []string, searchText,
	dateFrom, dateTo string, offset, limit uint) (*GetLogsResult, error) {
	logger := h.logger.Add("method", "GetLogs", "searchText",
		searchText, "levels", levels, "dateFrom", dateFrom, "dateTo",
		dateTo, "offset", offset, "limit", limit)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return nil, ErrAccessDenied
	}

	args := &getLogsArgs{
		level:      levels,
		dateTo:     dateTo,
		dateFrom:   dateFrom,
		searchText: searchText,
	}

	conditions, arguments := h.getLogsConditions(args)
	totalItems, err := h.getTotalLogEvents(logger, conditions, arguments)
	if err != nil {
		return nil, err
	}

	result, err := h.getLogs(logger, conditions, arguments, offset, limit)
	if err != nil {
		return nil, err
	}

	return &GetLogsResult{result, totalItems}, err
}
// GetLogs returns back end log, paginated.