Skip to content

Commit

Permalink
Use Message.log consistently.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomprince committed Jun 17, 2015
1 parent 157516b commit f29bb01
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/source/fields.rst
Expand Up @@ -25,9 +25,9 @@ Consider the following code sample:
from eliot import start_action, Message
with start_action(action_type=u"parent"):
Message.new(x="1").write()
Message.log(x="1")
with start_action(action_type=u"child"):
Message.new(x="2").write()
Message.log(x="2")
If you sort the resulting messages by their ``task_level`` you will get the tree of messages:

Expand Down
16 changes: 8 additions & 8 deletions docs/source/introduction.rst
Expand Up @@ -74,9 +74,9 @@ For simplicity's sake this example focuses on problems 1 and 3; problem 2 is cov
self.seen = set()
def look(self, thing):
Message.new(message_type="person:look",
Message.log(message_type="person:look",
person=unicode(self),
at=unicode(thing)).write()
at=unicode(thing))
self.seen.add(thing)
Expand All @@ -86,9 +86,9 @@ For simplicity's sake this example focuses on problems 1 and 3; problem 2 is cov
self.contained = []
def travel(self, person):
Message.new(message_type="place:travel",
Message.log(message_type="place:travel",
person=unicode(person),
place=self.name).write()
place=self.name)
for thing in self.contained:
if isinstance(thing, Place):
thing.travel(person)
Expand All @@ -101,8 +101,8 @@ For simplicity's sake this example focuses on problems 1 and 3; problem 2 is cov
def honeymoon(family):
Message.new(message_type="honeymoon",
family=[unicode(person) for person in family]).write()
Message.log(message_type="honeymoon",
family=[unicode(person) for person in family])
rome = Place.load("Rome, Italy")
for person in family:
rome.travel(person)
Expand Down Expand Up @@ -141,9 +141,9 @@ In our example we have one task (the honeymoon), an action (travel). We will lea
self.seen = set()
def look(self, thing):
Message.new(message_type="person:look",
Message.log(message_type="person:look",
person=unicode(self),
at=unicode(thing)).write()
at=unicode(thing))
self.seen.add(thing)
Expand Down
6 changes: 3 additions & 3 deletions eliot/tests/test_testing.py
Expand Up @@ -617,7 +617,7 @@ def test_default_logger(self):
class MyTest(TestCase):
@capture_logging(None)
def runTest(self, logger):
Message.new(some_key=1234).write()
Message.log(some_key=1234)
self.logger = logger

test = MyTest()
Expand All @@ -639,7 +639,7 @@ def runTest(self, logger):
messages = []
add_destination(messages.append)
self.addCleanup(remove_destination, messages.append)
Message.new(some_key=1234).write()
Message.log(some_key=1234)
self.assertEqual(messages[0][u"some_key"], 1234)


Expand All @@ -657,7 +657,7 @@ def runTest(self, logger):
messages = []
add_destination(messages.append)
self.addCleanup(remove_destination, messages.append)
Message.new(some_key=1234).write()
Message.log(some_key=1234)
self.assertEqual(messages[0][u"some_key"], 1234)


Expand Down
2 changes: 1 addition & 1 deletion examples/logfile.py
Expand Up @@ -19,7 +19,7 @@ def main(reactor):
logWriter.startService()

# Log a message:
Message.new(value="hello", another=1).write()
Message.log(value="hello", another=1)

# Manually stop the service.
done = logWriter.stopService()
Expand Down
4 changes: 2 additions & 2 deletions examples/stdout.py
Expand Up @@ -11,9 +11,9 @@


def main():
Message.new(value="hello", another=1).write()
Message.log(value="hello", another=1)
time.sleep(0.2)
Message.new(value="goodbye", another=2).write()
Message.log(value="goodbye", another=2)


if __name__ == '__main__':
Expand Down

0 comments on commit f29bb01

Please sign in to comment.