WithIndent
Adds an additional indentation level to the context. It retrieves the current indentation level from the context, appends the provided additional indent string, and returns a new context with the updated indentation level.
def WithIndent(
ctx: context.Context,
additionalIndent: string
) - > context.Context
Adds an additional indentation level to the provided context. This function is used to manage and propagate indentation settings across different parts of an application, typically for logging or structured output.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context to which the additional indentation will be applied. This context should ideally contain an existing indentation level. |
| additionalIndent | string | The string representing the additional indentation to be added to the current indent level. For example, " " for two spaces or "\t" for a tab. |
Returns
| Type | Description |
|---|---|
context.Context | A new context derived from the input context, with the updated indentation level. |