Skip to content

Commit

Permalink
better test support
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed May 16, 2018
1 parent d24ee99 commit 78b7d63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/examples/app.py
Expand Up @@ -56,11 +56,20 @@ def index(self):

@appier.route("/log/<str:message>", "GET")
def log(self, message):
tag = self.field("tag", "default")
tag = self.field("tag", "http")
api = self.get_api()
result = api.log(dict(message = message), tag = tag)
return result

@appier.route("/log_bulk", "GET")
def log_bulk(self):
messages = self.field("messages", ["hello", "world"], cast = list)
tag = self.field("tag", "http")
api = self.get_api()
messages_l = [dict(message = message) for message in messages]
result = api.log_bulk(messages_l, tag = tag)
return result

def get_api(self):
return base.get_api()

Expand Down
2 changes: 1 addition & 1 deletion src/loggly/base.py
Expand Up @@ -67,7 +67,7 @@ def log(self, payload, tag = "http", silent = True):
return contents

def log_bulk(self, logs, tag = "http", silent = True):
url = self.base_bulk_url + "tags/%s" % tag
url = self.token_bulk_url + "tags/%s" % tag
buffer = []
for log in logs:
log_s = json.dumps(log)
Expand Down

0 comments on commit 78b7d63

Please sign in to comment.