setEnvironment static method
void
setEnvironment(
- Environment env, {
- bool? isDebugMode,
- ZuraffaLogLevel logLevel = ZuraffaLogLevel.all,
Set the application environment and debug mode.
typically called at the beginning of main().
If isDebugMode is not provided, it defaults to true for development
and false for staging and production.
If logLevel is provided, it sets the logging level when isDebugMode is true.
Implementation
static void setEnvironment(
Environment env, {
bool? isDebugMode,
ZuraffaLogLevel logLevel = ZuraffaLogLevel.all,
}) {
_environment = env;
_isDebugMode = isDebugMode ?? (env == Environment.development);
if (_isDebugMode || env == Environment.development) {
enableLogging(level: logLevel);
} else {
disableLogging();
}
Logger.root.info(
'Zuraffa environment set to: ${env.name} (isDebugMode: $_isDebugMode, logLevel: ${logLevel.name})',
);
}