コード例 #1
0
def initLogging(ainstConf, verbose):
    if not ainstConf:
        return False
    userLogLevel = 'info'
    if verbose:
        userLogLevel = 'debug'
    if not ainst_logging.init(ainstConf.logfile, ainstConf.loglevel,
                              userLogLevel):
        return False
    return True
コード例 #2
0
ファイル: ainst_initer.py プロジェクト: luckylecher/cpp
def initLogging(ainstConf, verbose):
    if not ainstConf:
        return False
    userLogLevel = 'info'
    if verbose:
        userLogLevel = 'debug'
    if not ainst_logging.init(ainstConf.logfile, ainstConf.loglevel,
                              userLogLevel):
        return False
    return True
コード例 #3
0
ファイル: logger.py プロジェクト: luckylecher/cpp
        content = fillChar * length + ' ' + label + ' ' + fillChar * length
        if len(content) < indent:
            content = content + fillChar * (indent - len(content))
        elif len(content) > indent:
            content = content[0:indent]
        return content

    @staticmethod
    def _getValueLine(key, value, indent=100):
        return key.ljust(indent - len(value)) + value

    @staticmethod
    def _getValueLines(keyValueList, indent=100):
        content = ''
        for key, value in keyValueList:
            content += Log._getValueLine(key, value, indent)
            content += '\n'
        return content

    @staticmethod
    def _getFileAndLineInfo():
        _, modulepath, line, _, _, _ = inspect.stack()[2]
        content = '[' + os.path.basename(modulepath) + ':' + str(line) + ']: '
        return content

if __name__ == "__main__":
    ainst_logging.init('./aaaaaa', logging.DEBUG, logging.DEBUG)
    Log.cout(Log.INFO, 'hello')
    Log.coutValue(Log.INFO, 'hello', 'ainst', Log.USER_LOGGER)
    Log.coutLabel(Log.INFO, 'hello', Log.AINST_LOGGER)