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

Colors in the capistrano.log file #105

Closed
mbouchard opened this issue Apr 8, 2017 · 3 comments
Closed

Colors in the capistrano.log file #105

mbouchard opened this issue Apr 8, 2017 · 3 comments

Comments

@mbouchard
Copy link

I was using capistrano 3.4 with airbrussh 0.3.0 and the capistrano.log file was formatted with colors that command like cat can print. Since I upgraded to capistrano 3.8, there's no color anymore in the log file. Is there a way to bring that feature back?

@mattbrictson
Copy link
Owner

Good question!

I am pretty sure this is due to a change in Capistrano itself. Capistrano now only uses color when it detects a color-capable console. Since a file is not a console, it automatically disables the color.

You can override this behavior by setting this environment variable:

SSHKIT_COLOR=1

There might be a way for Airbrussh to force the log file to always be color, without requiring the user to intervene by setting the environment variable. But I'm not sure if that is a behavior I want to hardcode. What do you think?

@robd any strong opinion on this one?

@robd
Copy link
Contributor

robd commented Apr 9, 2017

Hey

Nothing to add really other than to say I think this change happened in SSHKit Version 1.8: capistrano/sshkit#246 (discussion here: capistrano/sshkit#245)

We made the assumption that most people would not want ansii color escape sequences in the log files since it makes them hard to read in a normal text editor. We kept support for the SSHKIT_COLOR env var so that people could override this, such as in your case.

You can also set this in Ruby using ENV['SSHKIT_COLOR'] = '1'. I guess the best place to do this would be the Capfile - correct me if I'm wrong @mattbrictson.

@mbouchard
Copy link
Author

ENV['SSHKIT_COLOR'] = '1' did the trick. Thank you for your great gems!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants