Questions about the new warnidf function

  1. THIS IS AWESOME THANK YOU.
    I mean this… seriously…

That being said, I have a lot of messages like this in my partials:

{{- if and ($debug) (gt $debug 1) -}}
  {{- warnf "%s some warning thing %s" ($itsItchy.Get "logHeader") ($some-thing-value) -}}
{{- end -}}

Would either of these style of messageIDs be more efficient to process than my current if guard?

I’d think so??

if not, what would be the least inefficient way to give myself a few different verbosity level toggles related to component operations?

ignoreLogs:
- purposeOfThing.warn
- purposeOfThing.info
- purposeOfThing.debug
- someOtherComponent.warn
- someOtherComponent.info
- someOtherComponent.debug

or perhaps:

ignoreLogs:
- warn.purposeOfThing
- warn.SomeOtherThing
- info.purposeOfThing
- info.SomeOtherThing
- debug.purposeOfThing
- debug.SomeOtherThing

IMHO you can solve that with a third and particle that checks if my-error-id is in site.Params.silence which you can structure like the ignoreLogs list. As far as I understand any of the (error|warn)(id)f functions they come directly from golang and might not be that flexible to adapt to your system.

To distinguish between debug/info/warn/etc. you might use a partial that returns something after checking what level you have configured. I myself have a weird 0 to 9 level system with less and more verbose (2) levels of the 5 log levels (2*5=10). And, ehem, it gets chaotic. Golang tends to simplify things and removes anything that makes too much work.

You could adapt your system by checking with or, if any of the label.warn, label.info, label.debug IDs is not ignored and then show the error.

But, in the end, the idf functions might be more useful in regards to what you will remember 2 years from now about your individual system (ask me if debug is 0 or 9 in my “system”).

yeah… its easy to go off the rails here…

my intent was to have the warns present to help me verbosely describe my thought process as im writing stuff such that when futureme™️ comes back to something i can read my debug messages to grok why i thought something was a good idea at the time in a way that’s not obscenely wasteful of cycles…

it feels like a useful pattern to strive for but also somewhat complicated to do well…. so hoping that peeps smarter than i have also given thought to this and come up with a better solution …. this kinda feels like it might be that evolution, but im not sure… and i dont wanna retool all my jank just to create another glorious anti pattern yknow?