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

How to disable showing the name of the variable? #171

Open
kacperpaczos opened this issue Dec 24, 2023 · 0 comments
Open

How to disable showing the name of the variable? #171

kacperpaczos opened this issue Dec 24, 2023 · 0 comments

Comments

@kacperpaczos
Copy link

In this code:

from icecream import ic as original_ic
import datetime

def ic(*args, **kwargs):
    current_time = datetime.datetime.now().strftime("%H:%M:%S")
    log_message = f"<<{current_time}>> " + " ".join(map(str, args))
    try:
        original_ic(log_message, **kwargs)
    except Exception as e:
        original_ic(f"An error occurred: {e}")

I have output:

log_message: '<<22:49:48>> '
log_message: '<<22:49:48>> '
log_message: '<<22:49:48>> '
log_message: '<<22:49:48>> '
log_message: '<<22:49:48>> '
log_message: '<<22:49:48>> '
log_message: '<<22:49:48>> '
log_message: '<<22:49:48>> '
log_message: '<<22:49:48>> '
log_message: '<<22:49:48>> '

In this case, log_message is not necessary. How to disable showing the name of the variable?

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

1 participant