-
Notifications
You must be signed in to change notification settings - Fork 75
Logging Update #26
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
Logging Update #26
Conversation
| let service = rosNode.advertiseService('/set_bool', SetBool, | ||
| (req, resp) => { | ||
| console.log('Handling request! ' + JSON.stringify(req)); | ||
| rosnodejs.log.info('Handling request! ' + JSON.stringify(req)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I am a fan of verbosity. And I do like this fact that it is super obvious the kind of logger you are using here. But I am wondering how easy would it be for a user to alias rosnodejs.log.info as something like ros.info? Not saying that we need to do it for them though, just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could provide that - rospy provides all the methods with a log prefix to them (logerr, loginfo, logwarn, etc). This method lets you pull the logger out yourself and never refer to rosnodejs again though. So you could do
let log = rosnodejs.log;
log.info('A Message!');
You can also generate your owned named logger as a child of the root logger if you want to (and then it would be available through /get_loggers and /set_logger_level)
let customLogger = rosnodejs.log.getLogger('MyLogger');
customLogger.info('My other message');
You're less likely to get throttle or once clashes too if you create your own loggers as they each keep their own sets.
The log property from rosnodejs is actually the LoggingManager though. It exposes the logging methods of its root logger for ease of use. So all the methods available through rosnodejs.log are not necessarily available through loggers that you ask it to create.
|
Thank you for adding logging! Looks really good to me |
cb33b75 to
fd193d2
Compare
|
I'll squash this again before this gets merged - had a few fixes to make after pulling in upstream though and figured I'd make it clearer - should just be fd193d2. |
Pull request for issue #20. This is built on #19. I apparently also based it off of changes to add persistent service clients, which I thought was already in upstream but I guess I forgot to put up...
bunyanfor logging backend.rosnodejs.log./rosout