Skip to content

Commit 2d5b8a5

Browse files
jinnovationaoen
authored andcommitted
[AIRFLOW-3121] Define closed property on StreamLogWriter (apache#3955)
[AIRFLOW-3121] Define closed property on StreamLogWriter
1 parent 74c613b commit 2d5b8a5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

airflow/utils/log/logging_mixin.py

+11
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def _set_context(self, context):
6868
set_context(self.log, context)
6969

7070

71+
# TODO: Formally inherit from io.IOBase
7172
class StreamLogWriter(object):
7273
encoding = False
7374

@@ -83,6 +84,16 @@ def __init__(self, logger, level):
8384
self.level = level
8485
self._buffer = str()
8586

87+
@property
88+
def closed(self):
89+
"""
90+
Returns False to indicate that the stream is not closed (as it will be
91+
open for the duration of Airflow's lifecycle).
92+
93+
For compatibility with the io.IOBase interface.
94+
"""
95+
return False
96+
8697
def write(self, message):
8798
"""
8899
Do whatever it takes to actually log the specified logging record

0 commit comments

Comments
 (0)