[Python] How to disable robot framework automatically logging KubeLibrary response to DEBUG in...

Discussão em 'Python' iniciado por Stack, Abril 8, 2025.

  1. Stack

    Stack Membro Participativo

    I am utilizing robot framework's KubeLibrary to interact with my k8s cluster.

    By default, any function and response is automatically logged to DEBUG in robot framework, meaning that it's response will be visible in the log.html that robot framework generates.

    I want to disable this logging for some parts of my code or remove it afterwards somehow, e.g. I don't want the secrets to be part of the log.html regardless of log level.

    Current implementation which includes response in log.html when viewing DEBUG.


    from KubeLibrary import KubeLibrary

    ...

    def some_keyword():

    instance.kube = KubeLibrary(kube_config=instance.kubeconfig)

    secrets_matching_secret_name = instance.kube.get_secrets_in_namespace(
    name_pattern=f"^{secret_name}$",
    namespace=namespace
    )



    Wishful skeleton code for how it could be done


    instance.kube = KubeLibrary(kube_config=instance.kubeconfig)

    instance.kube.disable_debug_log()

    secrets_matching_secret_name = instance.kube.get_secrets_in_namespace(
    name_pattern=f"^{secret_name}$",
    namespace=namespace
    )

    instance.kube.enable_debug_log()



    Is there any way I can disable it? Or somehow filter it out from log.html using rebot or similar?

    Continue reading...

Compartilhe esta Página