question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simplified base logger's API

See original GitHub issue

🚀 Feature

Idea is to simplify current logger’s API by creating a shortcut methods: Currently, to log output parameters and optmizer’s params we do (example is for TB, but is generic for others too):

    logger = TensorboardLogger(...)
    logger.attach(
        trainer,
        log_handler=OutputHandler(tag="training", metric_names="all"),
        event_name=Events.ITERATION_COMPLETED(every=log_every_iters),
    )
    logger.attach(
        trainer,
        log_handler=OptimizerParamsHandler(optimizer, param_name="lr", tag=k),
        event_name=Events.ITERATION_STARTED(every=log_every_iters),
    )

Proposed API:

    logger = TensorboardLogger(...)
    logger.attach_output_handler(
        trainer,
        tag="training", metric_names="all",  # other args, kwargs of OutputHandler
        event_name=Events.ITERATION_COMPLETED(every=log_every_iters),
    )
    logger.attach_opt_params_handler(
        trainer,
        optimizer, param_name="lr", tag=k, # other args, kwargs of OutputHandler
        event_name=Events.ITERATION_STARTED(every=log_every_iters),
    )

In addition, this can fix “bad-practice” current implementation of setup_any_logging taking as input logger and logging_module: https://github.com/pytorch/ignite/blob/d1aa5fd5e71676032c952aa7470a651c216e2dd9/ignite/contrib/engines/common.py#L209

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
vfdev-5commented, Apr 29, 2020

@sdesrozis it’s too hacky for me, such approach.

Let’s implement the methods logger.attach_output_handler and logger.attach_opt_params_handler. Anyone would like to work on it ?

0reactions
sdesroziscommented, Apr 30, 2020

I will do it this week-end if nobody does 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic plugin: Using loggers to simplify debugging
Using Logger APIs. This is the recommended way for logging in plugins. All plugin instances have a logger property: using BepInEx; namespace MyFirstPlugin ......
Read more >
Add a verbalize logger to your base application. - GitHub
Contribute to base/base-logger development by creating an account on GitHub. ... Adds logger and mode methods to the app directly for easy logging....
Read more >
API Gateway logging - simplified - Knowledge base
Logs from different components like API Gateway Server, API Gateway UI, Internal Data Store, Security, Session, Platform , Wrapper.
Read more >
logging — Logging facility for Python — Python 3.11.1 ...
This module defines functions and classes which implement a flexible event logging system for applications and libraries. The key benefit of having the...
Read more >
API as a package: Logging - Jumping Rivers
In this installment of the series we look at adding some functions to our package that will take care of logging as our...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found