Giter Club home page Giter Club logo

monologue's People

Contributors

feth avatar gaelvaroquaux avatar nellev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

monologue's Issues

log with invocation context

At first, we need this poc to work :

from logging import Logger, StreamHandler, Formatter
import sys

logger = Logger("name")

handler = StreamHandler(sys.stdout)

class MyFormatter(Formatter):
    pass


myformatter = MyFormatter()
handler.setFormatter(myformatter)

logger.addHandler(handler)



class Bidon(object):
    """
    >>> b = Bidon()
    [Bidon] coucou
    """
    def __init__(self):
        logger.warning("coucou")

What about an ETA ?

While we're talking progress information, I was running a long computation by a sloppy friend coder of mine the other day, and there was no way to tell when I'd be able to get my machine back^W^W^W^Whand the result.

ETA stands for "estimated time of arrival". It belongs to the same family of features as percent completion and might look approx. like this:

[11/02/2012 18h14] [Long calculus] starting 100000 iterations
[11/02/2012 18h32] [Long calculus] 10% complete - 10000 iterations done - Estimated completion in 02h42m23s at 21h14
[11/02/2012 18h53] [Long calculus] 20% complete - 20000 iterations done - Estimated completion in 02h25m00s at 21h18
...

provide direct access to some attrs

Some attributes of the main object are managed by accessors.
Making these attributes public and removing accessors would reduce the cross section of this main object.

We're looking for API simplification whenever possible.

A good name for the main object

Main features:

  • displays progress
  • displays log messages

So the class was named ProgressAndLog and the main method get_logger.
Do you have a better idea? What do you think of the boring «reporter»?

enhance complete()

maybe provide a start() that accepts an optional id and returns it.

complete would provide a separator, the time elapsed, the iterations number (if relevant)

easy logging methods or default_logger ?

Do we prefer an API with

logger = get_logger()

or

log("coucou")

or both ?

For the latter, we could use a default_logger() method, that would enable the log method.

change get_logger signature

get_logger should not require a name, but optionnaly accept a prefix.

When not specified, the prefix should be calculated. See #10

ProcessAndLog object has no attribute 'step'

I get the above AttributeError when running the following example (from doc/manual.rst) :

# Configure: a dot every 10 steps
logger.dot_every(10)

# Configure: progress message every 100 steps
logger.progress_every(100)

# Optional: reset the number of iterations
logger.progress_reset()

while x != 1:

    # count one step
    logger.step()

    if x % 2 == 0:  # if x is odd
        x /= 2  # halve x
    else:
        x = 3 * x + 1

logger.complete()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.