Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs. Normal
(self, msg, kwargs)
| 1879 | self.merge_extra = merge_extra |
| 1880 | |
| 1881 | def process(self, msg, kwargs): |
| 1882 | """ |
| 1883 | Process the logging message and keyword arguments passed in to |
| 1884 | a logging call to insert contextual information. You can either |
| 1885 | manipulate the message itself, the keyword args or both. Return |
| 1886 | the message and kwargs modified (or not) to suit your needs. |
| 1887 | |
| 1888 | Normally, you'll only need to override this one method in a |
| 1889 | LoggerAdapter subclass for your specific needs. |
| 1890 | """ |
| 1891 | if self.merge_extra and kwargs.get("extra") is not None: |
| 1892 | if self.extra is not None: |
| 1893 | kwargs["extra"] = {**self.extra, **kwargs["extra"]} |
| 1894 | else: |
| 1895 | kwargs["extra"] = self.extra |
| 1896 | return msg, kwargs |
| 1897 | |
| 1898 | # |
| 1899 | # Boilerplate convenience methods |