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

Create a symlink to the latest log directory. #659

Closed
wants to merge 3 commits into from
Closed

Create a symlink to the latest log directory. #659

wants to merge 3 commits into from

Conversation

yoneken
Copy link
Contributor

@yoneken yoneken commented Aug 31, 2015

This change makes a symbolic link named "latest" to the latest log directory.

Many times I would like to grep error messages in the latest log directory.
This change may make someone's life more easier.

@ros-pull-request-builder
Copy link
Member

Can one of the admins verify this patch?

def renew_latest_logdir(logfile_dir):
log_dir = os.path.dirname(logfile_dir)
latest_dir = os.path.join(log_dir, 'latest')
if os.path.exists(latest_dir):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this check will work if the symlink exists by points to a not existing folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dirk-thomas
Thank you for the comment.
I fixed the issue to use os.path.lexists instead of os.path.exists.

yoneken and others added 2 commits September 2, 2015 07:43
* check if latest is actually a symlink before trying to remove it
* only try it on non-windows platforms
* print better error message depending on the failure case
@dirk-thomas
Copy link
Member

Thanks for the patch. I would like to improve it slightly before merging. Please see yoneken/ros_comm#1 for the suggested changed.

@yoneken
Copy link
Contributor Author

yoneken commented Sep 17, 2015

@dirk-thomas
Thank you for the patch. I confirmed that the function becomes better!

@dirk-thomas
Copy link
Member

Thanks. I have squashed and merged the changes in 28f8361.

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

Successfully merging this pull request may close these issues.

None yet

3 participants