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

Working but no color #3

Open
ghost opened this issue Dec 2, 2016 · 3 comments
Open

Working but no color #3

ghost opened this issue Dec 2, 2016 · 3 comments

Comments

@ghost
Copy link

ghost commented Dec 2, 2016

For example, here is my simple script using log4bash.sh

#!/bin/bash

source log4bash.sh

log "COOL"

log_warning "HELP!"
log_info "AWESOME"
log_success "WEWEWEWE"
log_error "ERROR!"

and the output is -

[2016-12-02 22:27:20 UTC] [INFO] COOL 
[2016-12-02 22:27:20 UTC] [WARNING] HELP! 
[2016-12-02 22:27:20 UTC] [INFO] AWESOME 
[2016-12-02 22:27:20 UTC] [SUCCESS] WEWEWEWE 
[2016-12-02 22:27:20 UTC] [ERROR] ERROR!

working fine, but no colo(u)r.

Thanks in advance.

@swelljoe
Copy link

swelljoe commented Mar 4, 2017

I noticed this problem on Linux systems. It comes down to line 19 being a special case for macOS, and it doesn't work right on Linux/BSD/etc. Uncommenting line 18 and removing line 19 might do the job, but I haven't tested, as I rewrote the whole test to work across other shells.

@rypz79
Copy link

rypz79 commented Sep 12, 2018

I noticed this problem on Linux systems. It comes down to line 19 being a special case for macOS, and it doesn't work right on Linux/BSD/etc. Uncommenting line 18 and removing line 19 might do the job, but I haven't tested, as I rewrote the whole test to work across other shells.

Hi, It doesn't work on Ubuntu 18.04
Any suggestions ?

TNX

@swelljoe
Copy link

I ended up forking and rewriting a bit to make it work on all POSIX shells and remove the Mac OS X-isms. I converted it to use tput for colors, which abstracts the color code so that it works on any system with a correctly configured termcap (and the tput command). My fork is here: https://github.com/swelljoe/slog

My fork doesn't have exactly the same semantics, so you'll need to modify your code a little, if you've been using log4bash.

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