kataras / golog

A high-performant Logging Foundation for Go Applications. X3 faster than the rest leveled loggers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I save logs in the database?

majidbigdeli opened this issue · comments

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

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!!

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