cloudydeno / deno-kubernetes_client

Typescript library for accessing a Kubernetes API server
https://deno.land/x/kubernetes_client
Apache License 2.0
18 stars 4 forks source link

The line is logging (almost) every request to stderr #4

Closed justinmchase closed 3 years ago

justinmchase commented 3 years ago

https://github.com/cloudydeno/deno-kubernetes_client/blob/main/transports/via-kubeconfig.ts#L102

I am finding it useful at the moment as I'm debugging but I kind of wish it was optionally logged. I'm not sure how deno logging is supposed to work yet but something like the old debug library to enable trace logging in submodules if desired would be nice.

danopia commented 3 years ago

Fair point here. The KubectlRawRestClient only does its logging when --verbose is passed, which works but isn't the best criteria: https://github.com/cloudydeno/deno-kubernetes_client/blob/main/transports/via-kubectl-raw.ts#L10 I just haven't had the need to do similar logic in KubeConfigRestClient because I don't use it interactively, and I've been appreciating the logs when deployed into a cluster ;)

If the --verbose flag works for you then that makes sense to copy over to the other file to increase parity.

Deno's runtime doesn't have any real opinions on logging... it's up to the module to use a proper logging module if it wants one.

justinmchase commented 3 years ago

Deno does have a log library in the std library: https://deno.land/std@0.101.0/log

I haven't looked into it in depth yet but I'm wondering if it will help here.

danopia commented 3 years ago

/std/log can help with managing log levels, but it still needs to be configured by the application - it doesn't handle letting the user change the log level, for example. There's a hardcoded default level/config and if you want for example a --verbose flag it's up to you to wire it.

So I don't see value in adding the library just for this; I'll just copy the --verbose flag over. More flexible logging would be a different ticket

justinmchase commented 3 years ago

I see. They should probably add log categorization and enable / disablement of categories to that api, to replace debug.