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

Integration with Revel logger? #44

Closed
leebrooks0 opened this issue Jan 3, 2014 · 4 comments
Closed

Integration with Revel logger? #44

leebrooks0 opened this issue Jan 3, 2014 · 4 comments

Comments

@leebrooks0
Copy link
Contributor

How would I best integrate the Revel logger (http://robfig.github.io/revel/manual/logging.html) with Gorm?

Would this work?

db.SetLogger(Revel.INFO)
@jinzhu
Copy link
Member

jinzhu commented Jan 3, 2014

Yes, this should works.

For those values match this interface could be used as gorm's logger https://github.com/jinzhu/gorm/blob/master/logger.go#L11

But I guess maybe you want to format the outputs like this. https://github.com/jinzhu/gorm/blob/master/logger.go#L22

@jinzhu jinzhu closed this as completed Jan 3, 2014
@leebrooks0
Copy link
Contributor Author

How would I format the outputs with Revel so it formats like this https://github.com/jinzhu/gorm/blob/master/logger.go#L22 ? I am too green with Go right now to work out what to do...

@jinzhu
Copy link
Member

jinzhu commented Jan 3, 2014

You could just copy those code to format log messages.

But I just improved gorm, so you don't have to format the log by yourself, but do it like this:

db.SetLogger(gorm.Logger{revel.TRACE})

@leebrooks0
Copy link
Contributor Author

Looks great, thanks!

On Fri, Jan 3, 2014 at 1:32 PM, Jinzhu notifications@github.com wrote:

You could just copy those code to format log messages.

But I just improved gorm, so you don't have to format the log by yourself,
but do it like this:

db.SetLogger(gorm.Logger{revel.TRACE})


Reply to this email directly or view it on GitHubhttps://github.com/jinzhu/gorm/issues/44#issuecomment-31517490
.

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