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

Diffrent format / config for diffrent level #131

Open
yoni386 opened this issue Sep 6, 2018 · 1 comment
Open

Diffrent format / config for diffrent level #131

yoni386 opened this issue Sep 6, 2018 · 1 comment

Comments

@yoni386
Copy link

yoni386 commented Sep 6, 2018

Hello,
How to make different config / format for each level, e.g. make debug and info with specific properties.

Thank you

@iTrooz
Copy link

iTrooz commented Mar 25, 2024

#60 (comment)

You can easily create your own backend type, e.g:

type MyBackend struct {
	backend logging.Backend
}

func (b *MyBackend) Log(level logging.Level, calldepth int, rec *logging.Record) error {
	if level == logging.ERROR {
		formatted := rec.Formatted(calldepth)
		superImportantFunction(formatted)
		return nil
	} else {
		return b.backend.Log(level, calldepth, rec)
	}
}

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

No branches or pull requests

2 participants