> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wandb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I enable code logging with Sweeps?

To enable code logging for sweeps, add `wandb.log_code()` after initializing the W\&B Run. This step is necessary even when you enable code logging in your W\&B profile settings. For advanced code logging, see the [`wandb.log_code()` reference](/models/ref/python/experiments/run#log_code).

***

<Badge stroke shape="pill" color="orange" size="md">[Sweeps](/support/models/tags/sweeps)</Badge>
