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
Group versus Indent? #13
Comments
I didn't even think about $.logGroup("Some title");
await $`some_command`;
$.logGroupEnd(); When they really should be writing: $.logGroup("Some title");
try {
await $`some_command`;
} finally {
$.logGroupEnd();
} So, the provided function (which can be synchronous or asynchronous), forces the try/finally pattern under the hood which is why I prefer it. Maybe the api should allow people to choose which one they want to do especially where errors being thrown means the process exists, but I kind of like the idea of forcing the try/finally pattern under the hood. I don't have strong feelings though and maybe someone forgetting to do |
Yeah, I think I'll implement both apis after thinking about it, but recommend using the passed in function in API code rather than some top level script. |
options are great I think... You raise a good point about the potentially needing to do Not to over complicate things, but if you go with the stated version as well, it would be good to be able to determine the current depth. |
Working on upgrading some of our scripts today, so implemented this. You can use |
I have found the
.logIndent()
API to be odd/confusing. Having to wrap everything in some sort of async handler makes it very difficult to write straight forward imperative code. I personally like theconsole.group()
model, where there is a set state which gets indented and outdented in the order of execution.The text was updated successfully, but these errors were encountered: