)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"prefactoring utils to get statsd client and logging functions"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"Change-Id: I1caf36f088b27ae666d9c576dbe7a391cfe10551"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"ff988088_69cc268f","line":25,"updated":"2024-03-19 13:33:20.000000000","message":"you should only have one change-id in your commit message.  please remove all of them except for this one.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"}],"/PATCHSET_LEVEL":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"08749a62_adb27772","updated":"2024-03-19 13:33:20.000000000","message":"I know this patch is already getting pretty big and getting the tests working has been a chore; but I actually think a LOT more logging related code needs to come out of utils.\n\nthere\u0027s some py2 broken-ness and the commit message should be updated.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"}],"swift/common/utils/__init__.py":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":121,"context_line":"    parse_socket_string,"},{"line_number":122,"context_line":"    whataremyips,"},{"line_number":123,"context_line":")"},{"line_number":124,"context_line":"from logging.handlers import SysLogHandler"},{"line_number":125,"context_line":"import logging"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"utf16_decoder \u003d codecs.getdecoder(\u0027utf-16\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"8caaebb5_bff0f2fd","line":124,"updated":"2024-03-19 13:33:20.000000000","message":"one good reason to move `logging_monkey_patch` would be to get this stdlib baseclass out of the global utils module namespace.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":122,"context_line":"    whataremyips,"},{"line_number":123,"context_line":")"},{"line_number":124,"context_line":"from logging.handlers import SysLogHandler"},{"line_number":125,"context_line":"import logging"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"utf16_decoder \u003d codecs.getdecoder(\u0027utf-16\u0027)"},{"line_number":128,"context_line":"utf16_encoder \u003d codecs.getencoder(\u0027utf-16\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"976af29b_ffe323bd","line":125,"updated":"2024-03-19 13:33:20.000000000","message":"I really can\u0027t think of a better name for swift\u0027s logging related module than `swift.common.utils.logging` but importing stdlib `logging` in `utils/__init__.py` as `logging` will cause a namespace conflict.\n\nMaybe it\u0027s better to name swift\u0027s logging module something different; like `swift.common.logs` - and developers will come to understand \"logging\" is stdlib \"logging\" and \"logs\" is swift\u0027s \"logging\"\n\n... but I think it might be better to adopt the convention that `swift.common.utils.logging` provides all the interfaces you might need to interact with swift\u0027s logging in the supported and maintained pattern such that no swift code should ever NEED stdlib\u0027s logging module!  For anything you might think you should get from stdlib logging; instead look in `swift.common.utils.logging` for something that meets your needs, or just replace `import logging` with `from swift.common.utils import logging`!  I think it would be nice if w/i the swift code base the only place we import `stdlib_logging` is IN `swift.common.utils.logging`.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":470,"context_line":"    SysLogHandler.priority_map[\u0027NOTICE\u0027] \u003d \u0027notice\u0027"},{"line_number":471,"context_line":"    # Trying to log threads while monkey-patched can lead to deadlocks; see"},{"line_number":472,"context_line":"    # https://bugs.launchpad.net/swift/+bug/1895739"},{"line_number":473,"context_line":"    logging.logThreads \u003d 0"},{"line_number":474,"context_line":""},{"line_number":475,"context_line":""},{"line_number":476,"context_line":"def eventlet_monkey_patch():"}],"source_content_type":"text/x-python","patch_set":1,"id":"01630a0a_6e0a1c93","line":473,"updated":"2024-03-19 13:33:20.000000000","message":"It might be reasonable to move this function into `swift.common.utils.logging` but may not be necessary.\n\non one hand I could imagine myself opening swift\u0027s logging module if I needed to understand how it interacts with stdlib_logging wrt eventlet and locking\n\non the other hand it might be nice to have all the monkey_patching in one place; like `swift.common.utils.monkey_patch`\n\nFor now, if you move it you can still `from .logging import logging_monkey_patch` in this file","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":624,"context_line":"                 anonymization_method, anonymization_salt):"},{"line_number":625,"context_line":"    \"\"\""},{"line_number":626,"context_line":"    Make a line for logging that matches the documented log line format"},{"line_number":627,"context_line":"    for backend servers."},{"line_number":628,"context_line":""},{"line_number":629,"context_line":"    :param req: the request."},{"line_number":630,"context_line":"    :param res: the response."}],"source_content_type":"text/x-python","patch_set":1,"id":"cb7e1281_0621cb51","line":627,"updated":"2024-03-19 13:33:20.000000000","message":"I think this would be a good canidate to move to `swift.common.utils.logging` - it\u0027s used in the storage server\u0027s\n\nyou could either update their imports, or maintain a `from .logging import get_log_line` in this module.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":920,"context_line":"        global _fallocate_warned_about_missing"},{"line_number":921,"context_line":"        if not _fallocate_warned_about_missing:"},{"line_number":922,"context_line":"            logging.warning(\"Unable to locate fallocate, posix_fallocate in \""},{"line_number":923,"context_line":"                            \"libc.  Leaving as a no-op.\")"},{"line_number":924,"context_line":"            _fallocate_warned_about_missing \u003d True"},{"line_number":925,"context_line":"        return"},{"line_number":926,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"f014471f_5b34cb2d","line":923,"updated":"2024-03-19 13:33:20.000000000","message":"there\u0027s a number of places in this module where we follow this pattern of using the stdlib_logging module to emit messages to the default/root logger because we don\u0027t have a swift adapted logger instance available.\n\nFor clarity, esp if we have a `swift.common.utils.logging` module, here in `utils/__init__.py` I\u0027d prefer we change the import in this file to `import logging as stdlib_logging` to avoid a namespace collision and use the explicit `stdlib_logging.warning` or `stdlib_logging.error` functions in this module.\n\nOR implement our own \"blessed\" `swift.common.utils.logging.[debug,info,warning,error,exception]` functions that \"wrap\" the call into stdlib logging towards an effort to \"sandbox\" ALL imports of stdlib_logging into just `swift.common.utils.logging` and replace all the calls to `stdlib_logging` in bufferedhttp and other places to just `from swift.common.utils import logging`","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":1251,"context_line":"    __next__ \u003d next"},{"line_number":1252,"context_line":""},{"line_number":1253,"context_line":""},{"line_number":1254,"context_line":"class NullLogger(object):"},{"line_number":1255,"context_line":"    \"\"\"A no-op logger for eventlet wsgi.\"\"\""},{"line_number":1256,"context_line":""},{"line_number":1257,"context_line":"    def write(self, *args):"}],"source_content_type":"text/x-python","patch_set":1,"id":"50f9f6f4_d4d30818","line":1254,"updated":"2024-03-19 13:33:20.000000000","message":"this seems like a good candidate to move to `swift.common.logging` esp. if we move `capture_stdio(logger)`","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":1280,"context_line":"        pass"},{"line_number":1281,"context_line":""},{"line_number":1282,"context_line":""},{"line_number":1283,"context_line":"class LoggerFileObject(object):"},{"line_number":1284,"context_line":""},{"line_number":1285,"context_line":"    # Note: this is greenthread-local storage"},{"line_number":1286,"context_line":"    _cls_thread_local \u003d threading.local()"}],"source_content_type":"text/x-python","patch_set":1,"id":"39f28053_423eb206","line":1283,"updated":"2024-03-19 13:33:20.000000000","message":"this seems like a good candidate to move to `swift.common.logging` esp. if we move `capture_stdio(logger)`","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":1414,"context_line":"    return decorating_func"},{"line_number":1415,"context_line":""},{"line_number":1416,"context_line":""},{"line_number":1417,"context_line":"class SwiftLoggerAdapter(logging.LoggerAdapter):"},{"line_number":1418,"context_line":"    \"\"\""},{"line_number":1419,"context_line":"    A logging.LoggerAdapter subclass that also passes through StatsD method"},{"line_number":1420,"context_line":"    calls."}],"source_content_type":"text/x-python","patch_set":1,"id":"aba8fb06_10ba0ce2","line":1417,"updated":"2024-03-19 13:33:20.000000000","message":"this class is so annoying; it\u0027s doing two totally different things.\n\nIt\u0027s possible in the \"final form\" the responsibility of annotating the logger instance with statsd routing functions moves into `common.statsd_client` as part of configuring it when calling `get_logger`\n\nFor now since `swift.common.logging` is the only module that imports `StatsdClient` I think it\u0027d be reasonable to move this class as-is into `swift.common.logging`","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":1460,"context_line":"        self.logger.exception(msg, *a, **kw)"},{"line_number":1461,"context_line":""},{"line_number":1462,"context_line":""},{"line_number":1463,"context_line":"class PrefixLoggerAdapter(SwiftLoggerAdapter):"},{"line_number":1464,"context_line":"    \"\"\""},{"line_number":1465,"context_line":"    Adds an optional prefix to all its log messages. When the prefix has not"},{"line_number":1466,"context_line":"    been set, messages are unchanged."}],"source_content_type":"text/x-python","patch_set":1,"id":"c3dda2a3_1fe47816","line":1463,"updated":"2024-03-19 13:33:20.000000000","message":"I think this class should move with SwiftLoggerAdapter into `swift.common.utils.logging` - but since it\u0027s imported from a number of modules you\u0027ll need to either update their imports or maintain an `from .logging import PrefixLoggerAdapter` in this module.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":1481,"context_line":"        return (msg, kwargs)"},{"line_number":1482,"context_line":""},{"line_number":1483,"context_line":""},{"line_number":1484,"context_line":"class LogLevelFilter(object):"},{"line_number":1485,"context_line":"    \"\"\""},{"line_number":1486,"context_line":"    Drop messages for the logger based on level."},{"line_number":1487,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5fc99511_dd3e855c","line":1484,"updated":"2024-03-19 13:33:20.000000000","message":"AFAIK this is only used in the encryption middlewares - it could easily move the `swift.common.logging` and we could update the middleware\u0027s import path.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":1580,"context_line":""},{"line_number":1581,"context_line":"def capture_stdio(logger, **kwargs):"},{"line_number":1582,"context_line":"    \"\"\""},{"line_number":1583,"context_line":"    Log unhandled exceptions, close stdio, capture stdout and stderr."},{"line_number":1584,"context_line":""},{"line_number":1585,"context_line":"    param logger: Logger object to use"},{"line_number":1586,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"631fd53c_030df2f5","line":1583,"updated":"2024-03-19 13:33:20.000000000","message":"It might be reasonable to move function into `common.utils.logging` - although it\u0027s ostensibly related to daemonization and used in `common.wsgi` and `common.daemon` near `drop_privileges` - we don\u0027t have a `swift.common.system` yet and I\u0027d definately expect to find things like LoggerFileObject in `swift.common.logging` if/when I needed to modify/test them.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":1591,"context_line":"    # collect stdio file desc not in use for logging"},{"line_number":1592,"context_line":"    stdio_files \u003d [sys.stdin, sys.stdout, sys.stderr]"},{"line_number":1593,"context_line":"    console_fds \u003d [h.stream.fileno() for _junk, h in getattr("},{"line_number":1594,"context_line":"        get_logger, \u0027console_handler4logger\u0027, {}).items()]"},{"line_number":1595,"context_line":"    stdio_files \u003d [f for f in stdio_files if f.fileno() not in console_fds]"},{"line_number":1596,"context_line":""},{"line_number":1597,"context_line":"    with open(os.devnull, \u0027r+b\u0027) as nullfile:"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba98260a_6b9aca5a","line":1594,"updated":"2024-03-19 13:33:20.000000000","message":"this is the only place get_logger is used in this module; although I think it\u0027s been suggested `common.utils.get_logger` should be maintained as a valid import path for backwards compat with out-of-tree middlewares.\n\n... and it\u0027s such a weird pattern - we\u0027re hanging a global off a function!?","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"}],"swift/common/utils/loggerfuncs.py":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":12,"context_line":"# implied."},{"line_number":13,"context_line":"# See the License for the specific language governing permissions and"},{"line_number":14,"context_line":"# limitations under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"import errno"},{"line_number":18,"context_line":"import logging"}],"source_content_type":"text/x-python","patch_set":1,"id":"5683bb63_ec56a341","line":15,"updated":"2024-03-19 13:33:20.000000000","message":"py2 tests are NOT happy with this file; probably you just need a `from __future__ import print_function` like we had over in `utils/__init__.py`","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":53,"context_line":"    Returns False otherwise."},{"line_number":54,"context_line":"    \"\"\""},{"line_number":55,"context_line":"    return value is True or \\"},{"line_number":56,"context_line":"        (isinstance(value, six.string_types) and value.lower() in TRUE_VALUES)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"class PipeMutex(object):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3377ddb9_715aa2f0","line":56,"updated":"2024-03-19 13:33:20.000000000","message":"this doesn\u0027t belong here; perhaps it was moved out of utils/__init__.py to avoid a circular dependency - regardless it looks out of place in this module.  A better solution for organization to help with maintenance would be a new `common.utils.config` module.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"2a5f93780fefab7acf4b360ea8f39a86ae5a0dc5","unresolved":true,"context_lines":[{"line_number":443,"context_line":"        return msg"},{"line_number":444,"context_line":""},{"line_number":445,"context_line":""},{"line_number":446,"context_line":"def get_logger(conf, name\u003dNone, log_to_console\u003dFalse, log_route\u003dNone,"},{"line_number":447,"context_line":"               fmt\u003d\"%(server)s: %(message)s\", statsd_tail_prefix\u003dNone):"},{"line_number":448,"context_line":"    \"\"\""},{"line_number":449,"context_line":"    Get the current system logger using config settings."}],"source_content_type":"text/x-python","patch_set":1,"id":"864b3191_650e9ae6","line":446,"updated":"2024-03-19 13:33:20.000000000","message":"this module is called loggerfuncs but this is the only logging related function in the module.\n\nI have a preference to name this module `common.utils.logging` but `common.utils.logs` or `common.logging` or `common.utils.logger` might all be just as reasonable; `loggerfuncs` seems like a misnomer.","commit_id":"2d8ca38ba85515c1be4958db67d24e063a75236a"}]}
