fern/03-reference/baml_client/config.mdx
Various settings are configurable via environment variables.
| Setting | Environment Variable | Description | Default |
|---|---|---|---|
| Logging Level | BAML_LOG | The logging level to use (INFO, DEBUG, TRACE, WARN, ERROR, OFF) | INFO |
| Text / JSON Mode | BAML_LOG_JSON | Whether to log in JSON format or human-readable format (1, 0) | 0 |
| Max Log Chunk Size | BAML_LOG_MAX_MESSAGE_LENGTH | How large of a prompt / response will be logged (0 for no limit) | 64000 |
| Log Color Mode | BAML_LOG_COLOR_MODE | Whether to color the log output (auto, always, never) | auto |
Setting can also be modified via functions in baml_client.config.
Environment variable: BAML_LOG
def set_log_level(level: "INFO" | "DEBUG" | "TRACE" | "WARN" | "ERROR" | "OFF"):
...
Environment variable: BAML_LOG_JSON
Switches the log output between JSON and human-readable format.
def set_log_json_mode(enable: bool):
0 for unlimited
Environment variable: BAML_LOG_MAX_MESSAGE_LENGTH
def set_log_max_message_length(length: int):
def get_log_level() -> "INFO" | "DEBUG" | "TRACE" | "WARN" | "ERROR" | "OFF":
Resets the environment variables to the values in the provided dictionary. Will also reset any logging related environment variables to those passed in (if set explicitly).
def reset_baml_env_vars(env: Dict[str, str]):
Environment variable: BAML_LOG
setLogLevel(level: "INFO" | "DEBUG" | "TRACE" | "WARN" | "ERROR" | "OFF"): void;
Environment variable: BAML_LOG_JSON
Switches the log output between JSON and human-readable format.
setLogJsonMode(enable: boolean): void;
Environment variable: BAML_LOG_MAX_MESSAGE_LENGTH
0 for unlimited
setLogMaxMessageLength(length: number): void;
getLogLevel(): "INFO" | "DEBUG" | "TRACE" | "WARN" | "ERROR" | "OFF";
Resets the environment variables to the values in the provided dictionary. Will also reset any logging related environment variables to those passed in (if set explicitly).
resetBamlEnvVars(env: Record<string, string | undefined>): void;
let result = B.ExtractResume .with_env_var("BAML_LOG", "DEBUG") .call("...") .unwrap();
</Tab>
<Tab title="ruby" language="ruby">
```ruby
# not implemented yet
# please use environment variables instead