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

Improve the story of using this from inside composable functions #16

Open
StylianosGakis opened this issue Aug 28, 2022 · 2 comments
Open

Comments

@StylianosGakis
Copy link

Currently, when inside a top level function (ofter true for composable funs) the api forces you to pass a tag manually, sort of killing the simplicity of "I just want to log something here" this library usually provides.
With that said, as far as I am aware there is no way to simply by default take the function name as the tag or something similar, so maybe this isn't a solvable problem and we simply have to pass a tag ourselves in such cases. If that's the case feel free to simply close this issue.

@matejdro
Copy link

matejdro commented Mar 2, 2023

Maybe we could fallback to Timber-esque getting file name from Exception in this case?

@matejdro
Copy link

matejdro commented Mar 2, 2023

Another good workaround is to define a live template, for example clog (as in, compose log):

logcat("$methodName$") { "$CODE$" } and then you set methodName's expression to kotlinFunctionName().

This live template would prefill method name, allowing you to just as easily start logging in couple keystrokes.

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