Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Implement process_post for 'any' channel posts.
Browse files Browse the repository at this point in the history
  • Loading branch information
archaelus committed Dec 4, 2012
1 parent 659e690 commit c2a2100
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/logplex_logs_rest.erl
Expand Up @@ -137,12 +137,17 @@ malformed_request(Req, State) ->

process_post(Req, State = #state{token = Token,
channel_id = ChannelId,
name = Name})
when is_binary(Token) ->
name = Name}) ->
try parse_logplex_body(Req, State) of
{parsed, Req2, State2 = #state{msgs = Msgs}} when is_list(Msgs)->
{parsed, Req2, State2 = #state{msgs = Msgs}}
when is_list(Msgs), is_binary(Token),
is_integer(ChannelId), is_binary(Name) ->
logplex_message:process_msgs(Msgs, ChannelId, Token, Name),
{true, Req2, State2#state{msgs = []}};
{parsed, Req2, State2 = #state{msgs = Msgs}}
when Token =:= any, ChannelId =:= any ->
logplex_message:process_msgs(Msgs),
{true, Req2, State2#state{msgs = []}};
{{error, Reason}, Req2, State2} ->
?WARN("at=parse_logplex_body error=~p", [Reason]),
%% XXX - Log parse failure
Expand Down

0 comments on commit c2a2100

Please sign in to comment.