Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upper/db/v4 Logging source of line where SQL was executed #599

Open
derkan opened this issue Oct 2, 2020 · 2 comments
Open

upper/db/v4 Logging source of line where SQL was executed #599

derkan opened this issue Oct 2, 2020 · 2 comments
Assignees

Comments

@derkan
Copy link

derkan commented Oct 2, 2020

Hi,
As query logging is being run deferred;

	defer func(start time.Time) {
		queryLog(&QueryStatus{
			TxID:    sess.txID,
			SessID:  sess.sessID,
			Query:   query,
			Err:     err,
			Start:   start,
			End:     time.Now(),
			Context: ctx,
		})
	}(time.Now())

We lost caller file:line location. Because of this, current logger always prints location as ...sqladapter/session.go:647 which is meaningless.

func (c *loggingCollector) logf(level LogLevel, f string, v ...interface{}) {
	format := level.String() + "\n" + f
	if _, file, line, ok := runtime.Caller(2); ok {
		format = fmt.Sprintf("log_level=%s file=%s:%d\n%s", level, file, line, f)
	}
	format = "upper/db: " + format
...

I think we should respect logging as first-class.

@xiam xiam self-assigned this Dec 5, 2020
@hkhere
Copy link

hkhere commented Jun 12, 2022

I found it was hard to look for useful information when the motst of the screen was full of stack output during development phase. Is that a way to turn off stack output?

@VojtechVitek
Copy link
Member

Hi @xiam, do you plan to work on this (you're self-assigned)? Or do you prefer reviewing a contribution from someone from the community at this time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants