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

How can I save logs in the database? #14

Open
majidbigdeli opened this issue May 27, 2019 · 3 comments
Open

How can I save logs in the database? #14

majidbigdeli opened this issue May 27, 2019 · 3 comments
Labels

Comments

@majidbigdeli
Copy link

How can we save logs in the database? Like log4net in .NET

@kataras
Copy link
Owner

kataras commented Jun 20, 2019

Hello @majidbigdeli, sorry for the late response but you already know how much I am deep into the upcoming release of iris:P

golog supports unlimited number of simultaneously output targets. with AddOutput(io.Writer) method. The easier thing I can think is that you can create an io.Writer that will save the p []byte parameter input to the database.

Like the _examples/multi-output/main.go does for os.File. And the good part is that colors are automatically removed from the log line if an output target is not a terminal instance*.

If that didn't help you or your use case requires a special feature to live inside the library itself regarding this matter please post below.

Thanks!!

@majidbigdeli
Copy link
Author

@kataras . Thank you .
yes. I Create io.Writer inteface for logging to sql server database. It works.

@kataras
Copy link
Owner

kataras commented Jul 5, 2019

You're welcome @majidbigdeli.

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

No branches or pull requests

2 participants