Did I find the right examples for you? yes no

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)
Try to format the string C{fmtString} using C{fmtDict} arguments,
swallowing all errors to always return a string.

        def _safeFormat(fmtString, fmtDict):
    """
    Try to format the string C{fmtString} using C{fmtDict} arguments,
    swallowing all errors to always return a string.
    """
    # There's a way we could make this if not safer at least more
    # informative: perhaps some sort of str/repr wrapper objects
    # could be wrapped around the things inside of C{fmtDict}. That way
    # if the event dict contains an object with a bad __repr__, we
    # can only cry about that individual object instead of the
    # entire event dict.
    try:
        text = fmtString % fmtDict
    except KeyboardInterrupt:
        raise
    except:
        try:
            text = ('Invalid format string or unformattable object in log message: %r, %s' % (fmtString, fmtDict))
        except:
            try:
                text = 'UNFORMATTABLE OBJECT WRITTEN TO LOG with fmt %r, MESSAGE LOST' % (fmtString,)
            except:
                text = 'PATHOLOGICAL ERROR IN BOTH FORMAT STRING AND MESSAGE DETAILS, MESSAGE LOST'
    return text
        


src/t/w/TwistedBot-HEAD/twistedbot/logbot.py   TwistedBot(Download)
        fmtDict = {'header': eventDict['header'], 'text':
                   text.replace("\n", "\n\t")}
        msgStr = log._safeFormat("[%(header)s] %(text)s\n", fmtDict)
        util.untilConcludes(self.write, timeStr + " " + msgStr)
        util.untilConcludes(self.flush)

src/n/o/nodeset.core-HEAD/src/nodeset/common/log.py   nodeset.core(Download)
        fmtDict = {'system': eventDict['system'], 'text': text.replace("\n", "\n\t"),
                   'logLevel': eventDict['logLevel']}
        msgStr = log._safeFormat("[%(logLevel)s] [%(system)s] %(text)s\n", fmtDict)
 
        util.untilConcludes(self.write, timeStr + " " + msgStr)

src/p/u/pushproxy-HEAD/src/icl0ud/logger.py   pushproxy(Download)
        timeStr = self.formatTime(eventDict['time'])
        fmtDict = {'time': timeStr, 'text': text}
        output = log._safeFormat('%(time)s %(text)s\n', fmtDict)
        util.untilConcludes(self.write, output)
        util.untilConcludes(self.flush)

src/t/x/tx-logging-1.0.0/tx_logging/observers.py   tx-logging(Download)
        }
        msg_str = log._safeFormat(
            "%(level)8s:[%(system)s]: %(text)s\n", fmt_dict)
 
        util.untilConcludes(self.write, "{0} {1}".format(time_str, msg_str))

src/e/m/emen2-2.2b7/emen2/db/log.py   emen2(Download)
 
from twisted.python import util
from twisted.python.log import _safeFormat, textFromEventDict
 
import emen2.db.config