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 timestamps to each message #82

Closed

Conversation

vickychijwani
Copy link

Enabled with the --timestamp flag. Fixes #9.

All I've done is rebase @marczych's commit in PR #34 to the latest master. I've also removed the short -t flag because it's already being used for tags. Let me know if any other changes are required to get this merged in.

Enabled with the -t flag. Fixes JakeWharton#9
@@ -41,6 +41,7 @@
parser.add_argument('-c', '--clear', dest='clear_logcat', action='store_true', help='Clear the entire log before running.')
parser.add_argument('-t', '--tag', dest='tag', action='append', help='Filter output by specified tag(s)')
parser.add_argument('-i', '--ignore-tag', dest='ignored_tag', action='append', help='Filter output by ignoring specified tag(s)')
parser.add_argument('--timestamp', dest='add_timestamp', action='store_true', help='Prepend each line of output with the current time.')

Choose a reason for hiding this comment

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

What happened to the first argument ('-t')?

Copy link
Author

Choose a reason for hiding this comment

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

Removed it because it's already being used to filter by tag.

@marczych
Copy link

Looks good to me other than my one comment!

@JakeWharton
Copy link
Owner

The output looks to be the same. My biggest gripe with the original PR was how it looked. For instance, the date is not useful information.

@vickychijwani
Copy link
Author

@JakeWharton I've removed the date already. Is there anything else you'd like me to change?

@@ -145,7 +146,10 @@ def allocate_color(tag):
PID_KILL = re.compile(r'^Killing (\d+):([a-zA-Z0-9._:]+)/[^:]+: (.*)$')
PID_LEAVE = re.compile(r'^No longer want ([a-zA-Z0-9._:]+) \(pid (\d+)\): .*$')
PID_DEATH = re.compile(r'^Process ([a-zA-Z0-9._:]+) \(pid (\d+)\) has died.?$')
LOG_LINE = re.compile(r'^([A-Z])/(.+?)\( *(\d+)\): (.*?)$')
if args.add_timestamp:
Copy link
Owner

Choose a reason for hiding this comment

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

It doesn't make sense to have this logic sprinkled all over. Always capture the timestamp and just have the condition on whether or not it gets displayed.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@JakeWharton
Copy link
Owner

I don't like this output. While you fixed my issues with the timestamp itself simply prepending it to the message is ugly as demonstrated in the original PR.

@BoD
Copy link

BoD commented Jun 12, 2015

What needs to be done for this to be accepted? I really like pidcat, but the absence of a timestamp is very frustrating.

@vickychijwani
Copy link
Author

@BoD I think Jake wants the timestamp to be formatted in a separate column and made visually distinct (like the tags and log levels). See the discussion on the original PR. I just haven't had time to get to it.

@jude07
Copy link

jude07 commented Apr 12, 2016

@JakeWharton @vickychijwani @marczych @BoD Has something changed here??
I've got pidcat installed and it works fine.But I am having trouble viewing my logs with the timestamps.
I am doing a *pidcat "my-package-name" -t * , (I've also tried --t , --timestamp)
Is this the correct syntax?

@marczych
Copy link

@jude07 None of the timestamp pulls have been merged as far as I know so you'll have to use one of the forks to get that option.

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.

Add support for timestamps
5 participants