-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Kepoor Hampond edited this page Mar 26, 2017
·
7 revisions
import draftlog
: What actually imports the module.
draft = draftlog.inject()
: What injects the line counter into the stdout
stream. The rest of the docs will refer to draft
as in the function draftlog.inject()
draft.log(text="\n")
: Returns a LogDraft
object that is responsible for updating itself. text
can be a normal string that will always have \n
appended to it.
-
update(text)
: Update the line with some new text. It's recommended that there are no\n
(newline characters) in the string. -
set_interval(function, time, loader=False, update=True
: Adds an interval into a background thread process. It's meant to mimicnodejs
'ssetInterval
function. The intervals can be started withdraft.start()
. Ifloader
is set equal toTrue
, then the exit of the intervals will not depend on it. If update is set toFalse
, then each new update will be set on a new line. See theexamples
folder for some examples.