@ -202,7 +202,7 @@ def reset_temp_dir(econtext):
@mitogen.core.takes_econtext
@mitogen.core.takes_econtext
def init_child ( econtext ):
def init_child ( econtext , log_level ):
"""
"""
Called by ContextService immediately after connection ; arranges for the
Called by ContextService immediately after connection ; arranges for the
( presently ) spotless Python interpreter to be forked , where the newly
( presently ) spotless Python interpreter to be forked , where the newly
@ -213,6 +213,9 @@ def init_child(econtext):
polluting the global interpreter state in a way that effects explicitly
polluting the global interpreter state in a way that effects explicitly
isolated modules .
isolated modules .
: param int log_level :
Logging package level active in the master .
: returns :
: returns :
Dict like : :
Dict like : :
@ -230,6 +233,12 @@ def init_child(econtext):
_fork_parent = econtext . router . fork ( )
_fork_parent = econtext . router . fork ( )
reset_temp_dir ( econtext )
reset_temp_dir ( econtext )
# Copying the master's log level causes log messages to be filtered before
# they reach LogForwarder, thus reducing an influx of tiny messges waking
# the connection multiplexer process in the master.
LOG . setLevel ( log_level )
logging . getLogger ( ' ansible_mitogen ' ) . setLevel ( log_level )
return {
return {
' fork_context ' : _fork_parent ,
' fork_context ' : _fork_parent ,
' home_dir ' : mitogen . core . to_text ( os . path . expanduser ( ' ~ ' ) ) ,
' home_dir ' : mitogen . core . to_text ( os . path . expanduser ( ' ~ ' ) ) ,