prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Bug: Structlog example no longer works
  Me again. Sorry 🙈 
  
  **Describe the bug**
  Running the structlog example [here](https://starlite-api.github.io/starlite/1.48/usage/0-the-starlite-app/?h=structlog#using-structlog) results in an internal server error as of v1.45 (I think)
  
  ```
  {"status_code":500,"detail":"TypeError(\"encode_json() got an unexpected keyword argument 'default'\")"}
  ```
  
  The default encoder was changed [here](https://github.com/starlite-api/starlite/pull/891/files#diff-6b2294023eb60948cd9f742e4930255a72254daf74f9e3157df8d479a685b123R213)
  Which doesn't accept the `default` argument given [here](https://github.com/hynek/structlog/blob/main/src/structlog/processors.py#L318)
  
  I'm not sure if it's a structlog problem or a starlite problem.
  
  Maybe the solution is to rename `enc_hook` to `default` then it mirrors the signature of `json.dumps`? I'm not sure, to be honest.
  
  
  **To Reproduce**
  Run the structlog example in the documentation:
  ```python
  from starlite import Starlite, StructLoggingConfig, Request, get
  
  
  @get("/")
  def my_router_handler(request: Request) -> None:
      request.logger.info("inside a request")
      return None
  
  
  logging_config = StructLoggingConfig()
  
  app = Starlite(route_handlers=[my_router_handler], logging_config=logging_config)
  ```
  
  **Additional context**
  Add any other context about the problem here.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `starlite/utils/serialization.py`
  Content:
  ```
  1 from pathlib import PurePosixPath
  2 from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union
  3 
  4 import msgspec
  5 from pydantic import (
  6     AnyUrl,
  7     BaseModel,
  8     ByteSize,
  9     ConstrainedBytes,
  10     ConstrainedDate,
  11     ConstrainedDecimal,
  12     ConstrainedFloat,
  13     ConstrainedFrozenSet,
  14     ConstrainedInt,
  15     ConstrainedList,
  16     ConstrainedSet,
  17     ConstrainedStr,
  18     EmailStr,
  19     NameEmail,
  20     PaymentCardNumber,
  21     SecretField,
  22     StrictBool,
  23 )
  24 from pydantic.color import Color
  25 
  26 if TYPE_CHECKING:
  27     from starlite.types import TypeEncodersMap
  28 
  29 DEFAULT_TYPE_ENCODERS: "TypeEncodersMap" = {
  30     PurePosixPath: str,
  31     # pydantic specific types
  32     BaseModel: lambda m: m.dict(),
  33     ByteSize: lambda b: b.real,
  34     EmailStr: str,
  35     NameEmail: str,
  36     Color: str,
  37     AnyUrl: str,
  38     SecretField: str,
  39     ConstrainedInt: int,
  40     ConstrainedFloat: float,
  41     ConstrainedStr: str,
  42     ConstrainedBytes: lambda b: b.decode("utf-8"),
  43     ConstrainedList: list,
  44     ConstrainedSet: set,
  45     ConstrainedFrozenSet: frozenset,
  46     ConstrainedDecimal: float,
  47     ConstrainedDate: lambda d: d.isoformat(),
  48     PaymentCardNumber: str,
  49     StrictBool: int,  # pydantic compatibility
  50 }
  51 
  52 
  53 def default_serializer(value: Any, type_encoders: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any:
  54     """Transform values non-natively supported by `msgspec`
  55 
  56     Args:
  57         value: A value to serialize#
  58         type_encoders: Mapping of types to callables to transforming types
  59     Returns:
  60         A serialized value
  61     Raises:
  62         TypeError: if value is not supported
  63     """
  64     if type_encoders is None:
  65         type_encoders = DEFAULT_TYPE_ENCODERS
  66     for base in value.__class__.__mro__[:-1]:
  67         try:
  68             encoder = type_encoders[base]
  69         except KeyError:
  70             continue
  71         return encoder(value)
  72     raise TypeError(f"Unsupported type: {type(value)!r}")
  73 
  74 
  75 def dec_hook(type_: Any, value: Any) -> Any:  # pragma: no cover
  76     """Transform values non-natively supported by `msgspec`
  77 
  78     Args:
  79         type_: Encountered type
  80         value: Value to coerce
  81 
  82     Returns:
  83         A `msgspec`-supported type
  84     """
  85     if issubclass(type_, BaseModel):
  86         return type_(**value)
  87     raise TypeError(f"Unsupported type: {type(value)!r}")
  88 
  89 
  90 _msgspec_json_encoder = msgspec.json.Encoder(enc_hook=default_serializer)
  91 _msgspec_json_decoder = msgspec.json.Decoder(dec_hook=dec_hook)
  92 _msgspec_msgpack_encoder = msgspec.msgpack.Encoder(enc_hook=default_serializer)
  93 _msgspec_msgpack_decoder = msgspec.msgpack.Decoder(dec_hook=dec_hook)
  94 
  95 
  96 def encode_json(obj: Any, enc_hook: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:
  97     """Encode a value into JSON.
  98 
  99     Args:
  100         obj: Value to encode
  101         enc_hook: Optional callable to support non-natively supported types
  102 
  103     Returns:
  104         JSON as bytes
  105     """
  106     if enc_hook is None or enc_hook is default_serializer:
  107         return _msgspec_json_encoder.encode(obj)
  108     return msgspec.json.encode(obj, enc_hook=enc_hook)
  109 
  110 
  111 def decode_json(raw: Union[str, bytes]) -> Any:
  112     """Decode a JSON string/bytes into an object.
  113 
  114     Args:
  115         raw: Value to decode
  116 
  117     Returns:
  118         An object
  119     """
  120     return _msgspec_json_decoder.decode(raw)
  121 
  122 
  123 def encode_msgpack(obj: Any, enc_hook: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:
  124     """Encode a value into MessagePack.
  125 
  126     Args:
  127         obj: Value to encode
  128         enc_hook: Optional callable to support non-natively supported types
  129 
  130     Returns:
  131         MessagePack as bytes
  132     """
  133     if enc_hook is None or enc_hook is default_serializer:
  134         return _msgspec_msgpack_encoder.encode(obj)
  135     return msgspec.msgpack.encode(obj, enc_hook=enc_hook)
  136 
  137 
  138 def decode_msgpack(raw: bytes) -> Any:
  139     """Decode a MessagePack string/bytes into an object.
  140 
  141     Args:
  142         raw: Value to decode
  143 
  144     Returns:
  145         An object
  146     """
  147     return _msgspec_msgpack_decoder.decode(raw)
  148
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/starlite/utils/serialization.py b/starlite/utils/serialization.py
  --- a/starlite/utils/serialization.py
  +++ b/starlite/utils/serialization.py
  @@ -93,19 +93,19 @@
   _msgspec_msgpack_decoder = msgspec.msgpack.Decoder(dec_hook=dec_hook)
   
   
  -def encode_json(obj: Any, enc_hook: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:
  +def encode_json(obj: Any, default: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:
       """Encode a value into JSON.
   
       Args:
           obj: Value to encode
  -        enc_hook: Optional callable to support non-natively supported types
  +        default: Optional callable to support non-natively supported types.
   
       Returns:
           JSON as bytes
       """
  -    if enc_hook is None or enc_hook is default_serializer:
  +    if default is None or default is default_serializer:
           return _msgspec_json_encoder.encode(obj)
  -    return msgspec.json.encode(obj, enc_hook=enc_hook)
  +    return msgspec.json.encode(obj, enc_hook=default)
   
   
   def decode_json(raw: Union[str, bytes]) -> Any:
  
verification_info: {"golden_diff": "diff --git a/starlite/utils/serialization.py b/starlite/utils/serialization.py\n--- a/starlite/utils/serialization.py\n+++ b/starlite/utils/serialization.py\n@@ -93,19 +93,19 @@\n _msgspec_msgpack_decoder = msgspec.msgpack.Decoder(dec_hook=dec_hook)\n \n \n-def encode_json(obj: Any, enc_hook: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:\n+def encode_json(obj: Any, default: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:\n     \"\"\"Encode a value into JSON.\n \n     Args:\n         obj: Value to encode\n-        enc_hook: Optional callable to support non-natively supported types\n+        default: Optional callable to support non-natively supported types.\n \n     Returns:\n         JSON as bytes\n     \"\"\"\n-    if enc_hook is None or enc_hook is default_serializer:\n+    if default is None or default is default_serializer:\n         return _msgspec_json_encoder.encode(obj)\n-    return msgspec.json.encode(obj, enc_hook=enc_hook)\n+    return msgspec.json.encode(obj, enc_hook=default)\n \n \n def decode_json(raw: Union[str, bytes]) -> Any:\n", "issue": "Bug: Structlog example no longer works\nMe again. Sorry \ud83d\ude48 \r\n\r\n**Describe the bug**\r\nRunning the structlog example [here](https://starlite-api.github.io/starlite/1.48/usage/0-the-starlite-app/?h=structlog#using-structlog) results in an internal server error as of v1.45 (I think)\r\n\r\n```\r\n{\"status_code\":500,\"detail\":\"TypeError(\\\"encode_json() got an unexpected keyword argument 'default'\\\")\"}\r\n```\r\n\r\nThe default encoder was changed [here](https://github.com/starlite-api/starlite/pull/891/files#diff-6b2294023eb60948cd9f742e4930255a72254daf74f9e3157df8d479a685b123R213)\r\nWhich doesn't accept the `default` argument given [here](https://github.com/hynek/structlog/blob/main/src/structlog/processors.py#L318)\r\n\r\nI'm not sure if it's a structlog problem or a starlite problem.\r\n\r\nMaybe the solution is to rename `enc_hook` to `default` then it mirrors the signature of `json.dumps`? I'm not sure, to be honest.\r\n\r\n\r\n**To Reproduce**\r\nRun the structlog example in the documentation:\r\n```python\r\nfrom starlite import Starlite, StructLoggingConfig, Request, get\r\n\r\n\r\n@get(\"/\")\r\ndef my_router_handler(request: Request) -> None:\r\n    request.logger.info(\"inside a request\")\r\n    return None\r\n\r\n\r\nlogging_config = StructLoggingConfig()\r\n\r\napp = Starlite(route_handlers=[my_router_handler], logging_config=logging_config)\r\n```\r\n\r\n**Additional context**\r\nAdd any other context about the problem here.\r\n\n", "before_files": [{"content": "from pathlib import PurePosixPath\nfrom typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union\n\nimport msgspec\nfrom pydantic import (\n    AnyUrl,\n    BaseModel,\n    ByteSize,\n    ConstrainedBytes,\n    ConstrainedDate,\n    ConstrainedDecimal,\n    ConstrainedFloat,\n    ConstrainedFrozenSet,\n    ConstrainedInt,\n    ConstrainedList,\n    ConstrainedSet,\n    ConstrainedStr,\n    EmailStr,\n    NameEmail,\n    PaymentCardNumber,\n    SecretField,\n    StrictBool,\n)\nfrom pydantic.color import Color\n\nif TYPE_CHECKING:\n    from starlite.types import TypeEncodersMap\n\nDEFAULT_TYPE_ENCODERS: \"TypeEncodersMap\" = {\n    PurePosixPath: str,\n    # pydantic specific types\n    BaseModel: lambda m: m.dict(),\n    ByteSize: lambda b: b.real,\n    EmailStr: str,\n    NameEmail: str,\n    Color: str,\n    AnyUrl: str,\n    SecretField: str,\n    ConstrainedInt: int,\n    ConstrainedFloat: float,\n    ConstrainedStr: str,\n    ConstrainedBytes: lambda b: b.decode(\"utf-8\"),\n    ConstrainedList: list,\n    ConstrainedSet: set,\n    ConstrainedFrozenSet: frozenset,\n    ConstrainedDecimal: float,\n    ConstrainedDate: lambda d: d.isoformat(),\n    PaymentCardNumber: str,\n    StrictBool: int,  # pydantic compatibility\n}\n\n\ndef default_serializer(value: Any, type_encoders: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any:\n    \"\"\"Transform values non-natively supported by `msgspec`\n\n    Args:\n        value: A value to serialize#\n        type_encoders: Mapping of types to callables to transforming types\n    Returns:\n        A serialized value\n    Raises:\n        TypeError: if value is not supported\n    \"\"\"\n    if type_encoders is None:\n        type_encoders = DEFAULT_TYPE_ENCODERS\n    for base in value.__class__.__mro__[:-1]:\n        try:\n            encoder = type_encoders[base]\n        except KeyError:\n            continue\n        return encoder(value)\n    raise TypeError(f\"Unsupported type: {type(value)!r}\")\n\n\ndef dec_hook(type_: Any, value: Any) -> Any:  # pragma: no cover\n    \"\"\"Transform values non-natively supported by `msgspec`\n\n    Args:\n        type_: Encountered type\n        value: Value to coerce\n\n    Returns:\n        A `msgspec`-supported type\n    \"\"\"\n    if issubclass(type_, BaseModel):\n        return type_(**value)\n    raise TypeError(f\"Unsupported type: {type(value)!r}\")\n\n\n_msgspec_json_encoder = msgspec.json.Encoder(enc_hook=default_serializer)\n_msgspec_json_decoder = msgspec.json.Decoder(dec_hook=dec_hook)\n_msgspec_msgpack_encoder = msgspec.msgpack.Encoder(enc_hook=default_serializer)\n_msgspec_msgpack_decoder = msgspec.msgpack.Decoder(dec_hook=dec_hook)\n\n\ndef encode_json(obj: Any, enc_hook: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:\n    \"\"\"Encode a value into JSON.\n\n    Args:\n        obj: Value to encode\n        enc_hook: Optional callable to support non-natively supported types\n\n    Returns:\n        JSON as bytes\n    \"\"\"\n    if enc_hook is None or enc_hook is default_serializer:\n        return _msgspec_json_encoder.encode(obj)\n    return msgspec.json.encode(obj, enc_hook=enc_hook)\n\n\ndef decode_json(raw: Union[str, bytes]) -> Any:\n    \"\"\"Decode a JSON string/bytes into an object.\n\n    Args:\n        raw: Value to decode\n\n    Returns:\n        An object\n    \"\"\"\n    return _msgspec_json_decoder.decode(raw)\n\n\ndef encode_msgpack(obj: Any, enc_hook: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:\n    \"\"\"Encode a value into MessagePack.\n\n    Args:\n        obj: Value to encode\n        enc_hook: Optional callable to support non-natively supported types\n\n    Returns:\n        MessagePack as bytes\n    \"\"\"\n    if enc_hook is None or enc_hook is default_serializer:\n        return _msgspec_msgpack_encoder.encode(obj)\n    return msgspec.msgpack.encode(obj, enc_hook=enc_hook)\n\n\ndef decode_msgpack(raw: bytes) -> Any:\n    \"\"\"Decode a MessagePack string/bytes into an object.\n\n    Args:\n        raw: Value to decode\n\n    Returns:\n        An object\n    \"\"\"\n    return _msgspec_msgpack_decoder.decode(raw)\n", "path": "starlite/utils/serialization.py"}], "after_files": [{"content": "from pathlib import PurePosixPath\nfrom typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union\n\nimport msgspec\nfrom pydantic import (\n    AnyUrl,\n    BaseModel,\n    ByteSize,\n    ConstrainedBytes,\n    ConstrainedDate,\n    ConstrainedDecimal,\n    ConstrainedFloat,\n    ConstrainedFrozenSet,\n    ConstrainedInt,\n    ConstrainedList,\n    ConstrainedSet,\n    ConstrainedStr,\n    EmailStr,\n    NameEmail,\n    PaymentCardNumber,\n    SecretField,\n    StrictBool,\n)\nfrom pydantic.color import Color\n\nif TYPE_CHECKING:\n    from starlite.types import TypeEncodersMap\n\nDEFAULT_TYPE_ENCODERS: \"TypeEncodersMap\" = {\n    PurePosixPath: str,\n    # pydantic specific types\n    BaseModel: lambda m: m.dict(),\n    ByteSize: lambda b: b.real,\n    EmailStr: str,\n    NameEmail: str,\n    Color: str,\n    AnyUrl: str,\n    SecretField: str,\n    ConstrainedInt: int,\n    ConstrainedFloat: float,\n    ConstrainedStr: str,\n    ConstrainedBytes: lambda b: b.decode(\"utf-8\"),\n    ConstrainedList: list,\n    ConstrainedSet: set,\n    ConstrainedFrozenSet: frozenset,\n    ConstrainedDecimal: float,\n    ConstrainedDate: lambda d: d.isoformat(),\n    PaymentCardNumber: str,\n    StrictBool: int,  # pydantic compatibility\n}\n\n\ndef default_serializer(value: Any, type_encoders: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any:\n    \"\"\"Transform values non-natively supported by `msgspec`\n\n    Args:\n        value: A value to serialize#\n        type_encoders: Mapping of types to callables to transforming types\n    Returns:\n        A serialized value\n    Raises:\n        TypeError: if value is not supported\n    \"\"\"\n    if type_encoders is None:\n        type_encoders = DEFAULT_TYPE_ENCODERS\n    for base in value.__class__.__mro__[:-1]:\n        try:\n            encoder = type_encoders[base]\n        except KeyError:\n            continue\n        return encoder(value)\n    raise TypeError(f\"Unsupported type: {type(value)!r}\")\n\n\ndef dec_hook(type_: Any, value: Any) -> Any:  # pragma: no cover\n    \"\"\"Transform values non-natively supported by `msgspec`\n\n    Args:\n        type_: Encountered type\n        value: Value to coerce\n\n    Returns:\n        A `msgspec`-supported type\n    \"\"\"\n    if issubclass(type_, BaseModel):\n        return type_(**value)\n    raise TypeError(f\"Unsupported type: {type(value)!r}\")\n\n\n_msgspec_json_encoder = msgspec.json.Encoder(enc_hook=default_serializer)\n_msgspec_json_decoder = msgspec.json.Decoder(dec_hook=dec_hook)\n_msgspec_msgpack_encoder = msgspec.msgpack.Encoder(enc_hook=default_serializer)\n_msgspec_msgpack_decoder = msgspec.msgpack.Decoder(dec_hook=dec_hook)\n\n\ndef encode_json(obj: Any, default: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:\n    \"\"\"Encode a value into JSON.\n\n    Args:\n        obj: Value to encode\n        default: Optional callable to support non-natively supported types.\n\n    Returns:\n        JSON as bytes\n    \"\"\"\n    if default is None or default is default_serializer:\n        return _msgspec_json_encoder.encode(obj)\n    return msgspec.json.encode(obj, enc_hook=default)\n\n\ndef decode_json(raw: Union[str, bytes]) -> Any:\n    \"\"\"Decode a JSON string/bytes into an object.\n\n    Args:\n        raw: Value to decode\n\n    Returns:\n        An object\n    \"\"\"\n    return _msgspec_json_decoder.decode(raw)\n\n\ndef encode_msgpack(obj: Any, enc_hook: Optional[Callable[[Any], Any]] = default_serializer) -> bytes:\n    \"\"\"Encode a value into MessagePack.\n\n    Args:\n        obj: Value to encode\n        enc_hook: Optional callable to support non-natively supported types\n\n    Returns:\n        MessagePack as bytes\n    \"\"\"\n    if enc_hook is None or enc_hook is default_serializer:\n        return _msgspec_msgpack_encoder.encode(obj)\n    return msgspec.msgpack.encode(obj, enc_hook=enc_hook)\n\n\ndef decode_msgpack(raw: bytes) -> Any:\n    \"\"\"Decode a MessagePack string/bytes into an object.\n\n    Args:\n        raw: Value to decode\n\n    Returns:\n        An object\n    \"\"\"\n    return _msgspec_msgpack_decoder.decode(raw)\n", "path": "starlite/utils/serialization.py"}]}