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

NewFlushCloseHandler bytes.Buffer does not implement handler.FlushCloseWriter #141

Closed
mykolq opened this issue Mar 20, 2024 · 1 comment
Closed
Assignees
Labels
question Further information is requested resolved

Comments

@mykolq
Copy link

mykolq commented Mar 20, 2024

System (please complete the following information):

  • OS: Windows
  • GO Version: 1.20.7
  • Pkg Version: 0.5.5

Describe the bug

Error in usage example of NewFlushCloseHandler or error in function

To Reproduce

buf := new(bytes.Buffer)
h := handler.NewFlushCloseHandler(&buf, slog.AllLevels)

Expected behavior

new FlushCloseHandler

@inhere inhere added enhancement New feature or request question Further information is requested and removed enhancement New feature or request labels Mar 21, 2024
@inhere
Copy link
Member

inhere commented Mar 24, 2024

Hi @mykolq

Can use:

buf := new(bytes.Buffer)
h := handler.NewIOWriterHandler(buf, slog.NormalLevels)

Or use github.com/gookit/goutil/byteutil.Buffer:

buf := &byteutil.Buffer{}
h := handler.NewFlushCloseHandler(buf, slog.NormalLevels)

@inhere inhere closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested resolved
Projects
None yet
Development

No branches or pull requests

2 participants