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

Log file name, line #73

Closed
geekerzp opened this issue Jun 26, 2014 · 6 comments
Closed

Log file name, line #73

geekerzp opened this issue Jun 26, 2014 · 6 comments

Comments

@geekerzp
Copy link

Hey, I want to log the logger.debug, logger.info, etc. call in controller information, sunch as callee , FILE, LINE , so I can trace the souce code information in log file.
How can i do that? Please

@roidrage
Copy link
Owner

You want to have callee, file and line included in the log lines for the request log?

@geekerzp
Copy link
Author

yes, e.g. in user.rb, i write logger.debug("hello world") in 38 line in foo method, then the log output [DEBUG user.rb: 38 in `foo'] hello world
thanks!!!

@roidrage
Copy link
Owner

That's something you'll have to configure in the logger you're using. lograge's purpose is only to log request lines, nothing else.

@geekerzp
Copy link
Author

OK, thanks, could you give me some suggestions? please

@roidrage
Copy link
Owner

You could implement your own logging method:

def log(message)
  Rails.logger.info("(From #{caller.first}: #{message}")
end

@geekerzp
Copy link
Author

Thanks!!!

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