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

Add time stamp to logs #40

Merged
merged 12 commits into from
Jun 8, 2020
Merged

Add time stamp to logs #40

merged 12 commits into from
Jun 8, 2020

Conversation

jnk5y
Copy link
Contributor

@jnk5y jnk5y commented Apr 30, 2020

No description provided.

@jnk5y
Copy link
Contributor Author

jnk5y commented May 1, 2020

Sorry, but I just noticed the older PR for adding time stamps. When I do a docker logs shepherd I don't get any timestamps and docker doesn't add them so this is really useful for me. I also have code to set the timezone through an env variable if you add timestamps.

@djmaze
Copy link
Collaborator

djmaze commented May 1, 2020

@jnk5y If you use docker logs or docker service logs, you just need to add the -t parameter to get timestamps as well.

I would prefer not to add functionality which docker itself provides as well.

@jnk5y
Copy link
Contributor Author

jnk5y commented May 1, 2020

Docker will only show logs in UTC and with this PR along with some more code I have you can have logs in your preferred timezone. Up to you of course.

@djmaze
Copy link
Collaborator

djmaze commented May 1, 2020

Not sure. I think I'd rather have this configurable (and disabled by default) via a separate variable.

That'd be the chance to add a log function instead of directly calling echo everywhere. Would you be willing to change this accordingly?

@jnk5y
Copy link
Contributor Author

jnk5y commented May 1, 2020

Yeah, I can tackle that. I can also add a verbose option for those who want all the logs.

@djmaze
Copy link
Collaborator

djmaze commented May 2, 2020

What exactly do you mean with all the logs? That we make the current logging optional?

@jnk5y
Copy link
Contributor Author

jnk5y commented May 4, 2020

Minimum logs would be when shepherd updates a service. Verbose would be everything else. If you have 10 services and they are all checked every 5 minutes that's 288*10 logs every day saying a service update was attempted. I really only care to know when an update occurred. I'm happy to make verbose mode the default.

@djmaze
Copy link
Collaborator

djmaze commented May 10, 2020

That sounds good to me. Go ahead!

jnk5y added 6 commits May 14, 2020 14:16
Log function which takes the log and whether it is considered a verbose mode log. If it is a verbose log and verbose mode is false it will NOT print the log. If verbose mode is true it will print all logs. Also using a timezone environment variable to set the timezone file at /etc/timezone.
@jnk5y
Copy link
Contributor Author

jnk5y commented May 14, 2020

I created a logging function and added a verbose logging mode. I also set the timezone from an environment variable. I also moved your environment variables from your dockerfile to the docker-compose file so they are easier to update. I have some merge conflicts that I can't quite fix myself if you could assist.

@djmaze
Copy link
Collaborator

djmaze commented Jun 1, 2020

@jnk5y Please leave the environment variables in the Dockerfile as well. They are serving as defaults so people do have to set each of them explicitely (e.g. when running without Docker Compose). Their values can be overridden in the compose file either way.

@jnk5y
Copy link
Contributor Author

jnk5y commented Jun 1, 2020

Done

jnk5y added 2 commits June 2, 2020 10:06
Didn't notice the original environment section when adding the new variables
@jnk5y
Copy link
Contributor Author

jnk5y commented Jun 5, 2020

Everything should now be resolved. Sorry I'm new at this so not sure if i'm doing things the right way.

@djmaze
Copy link
Collaborator

djmaze commented Jun 6, 2020

@jnk5y Thanks! I think we can remove the write to /etc/timezone, as stated above?

@jnk5y
Copy link
Contributor Author

jnk5y commented Jun 7, 2020

Tested without setting /etc/timezone and it worked so I removed it.

@djmaze djmaze merged commit 36afdf6 into containrrr:master Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants