#NEWLINE# def publishToNewObserver( observer , eventDict , textFromEventDict ) : #NEWLINE# #INDENT# "\n    Publish an old-style (L{twisted.python.log}) event to a new-style\n    (L{twisted.logger}) observer.\n\n    @note: It's possible that a new-style event was sent to a\n        L{LegacyLogObserverWrapper}, and may now be getting sent back to a\n        new-style observer.  In this case, it's already a new-style event,\n        adapted to also look like an old-style event, and we don't need to\n        tweak it again to be a new-style event, hence the checks for\n        already-defined new-style keys.\n\n    @param observer: A new-style observer to handle this event.\n    @type observer: L{ILogObserver}\n\n    @param eventDict: An L{old-style <twisted.python.log>}, log event.\n    @type eventDict: L{dict}\n\n    @param textFromEventDict: callable that can format an old-style event as a\n        string.  Passed here rather than imported to avoid circular dependency.\n    @type textFromEventDict: 1-arg L{callable} taking L{dict} returning L{str}\n\n    @return: L{None}\n    " #NEWLINE# if ( 'log_time' not in eventDict ) : #NEWLINE# #INDENT# eventDict [ 'log_time' ] = eventDict [ 'time' ] #NEWLINE# #UNINDENT# if ( 'log_format' not in eventDict ) : #NEWLINE# #INDENT# text = textFromEventDict ( eventDict ) #NEWLINE# if ( text is not None ) : #NEWLINE# #INDENT# eventDict [ 'log_text' ] = text #NEWLINE# eventDict [ 'log_format' ] = '{log_text}' #NEWLINE# #UNINDENT# #UNINDENT# if ( 'log_level' not in eventDict ) : #NEWLINE# #INDENT# if ( 'logLevel' in eventDict ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# level = fromStdlibLogLevelMapping [ eventDict [ 'logLevel' ] ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# level = None #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'isError' in eventDict ) : #NEWLINE# #INDENT# if eventDict [ 'isError' ] : #NEWLINE# #INDENT# level = LogLevel . critical #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# level = LogLevel . info #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# level = LogLevel . info #NEWLINE# #UNINDENT# #UNINDENT# if ( level is not None ) : #NEWLINE# #INDENT# eventDict [ 'log_level' ] = level #NEWLINE# #UNINDENT# #UNINDENT# if ( 'log_namespace' not in eventDict ) : #NEWLINE# #INDENT# eventDict [ 'log_namespace' ] = 'log_legacy' #NEWLINE# #UNINDENT# if ( ( 'log_system' not in eventDict ) and ( 'system' in eventDict ) ) : #NEWLINE# #INDENT# eventDict [ 'log_system' ] = eventDict [ 'system' ] #NEWLINE# #UNINDENT# observer ( text )