File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,20 @@ def test_custom_fmt(self):
6767 self .assertTrue ('lineno' in data [0 ][2 ])
6868 self .assertTrue ('emitted_at' in data [0 ][2 ])
6969
70+ def test_json_encoded_message (self ):
71+ handler = fluent .handler .FluentHandler ('app.follow' , port = self ._port )
72+
73+ logging .basicConfig (level = logging .INFO )
74+ log = logging .getLogger ('fluent.test' )
75+ handler .setFormatter (fluent .handler .FluentRecordFormatter ())
76+ log .addHandler (handler )
77+ log .info ('{"key": "hello world!", "param": "value"}' )
78+ handler .close ()
79+
80+ data = self .get_data ()
81+ self .assertTrue ('key' in data [0 ][2 ])
82+ self .assertEqual ('hello world!' , data [0 ][2 ]['key' ])
83+
7084 def test_unstructured_message (self ):
7185 handler = fluent .handler .FluentHandler ('app.follow' , port = self ._port )
7286
You can’t perform that action at this time.
0 commit comments