IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
14.5.5.1 StreamHandler

14.5.5.1 StreamHandler

The StreamHandler class, located in the core logging package, sends logging output to streams such as sys.stdout, sys.stderr or any file-like object (or, more precisely, any object which supports write() and flush() methods).

class StreamHandler( [strm])
Returns a new instance of the StreamHandler class. If strm is specified, the instance will use it for logging output; otherwise, sys.stderr will be used.

emit( record)
If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception() and appended to the stream.

flush( )
Flushes the stream by calling its flush() method. Note that the close() method is inherited from Handler and so does nothing, so an explicit flush() call may be needed at times.

See About this document... for information on suggesting changes.