forked from baron/baron-sso
make dev/dev-debug 구분.
This commit is contained in:
@@ -29,23 +29,37 @@ class LogPolicy {
|
||||
env == 'staging';
|
||||
}
|
||||
|
||||
static bool parseBoolFlag(String? raw) {
|
||||
static ({bool enabled, bool specified}) parseOptionalBoolFlag(String? raw) {
|
||||
final value = (raw ?? '').trim().toLowerCase();
|
||||
return value == '1' ||
|
||||
if (value == '1' ||
|
||||
value == 'true' ||
|
||||
value == 'yes' ||
|
||||
value == 'y' ||
|
||||
value == 'on';
|
||||
value == 'on') {
|
||||
return (enabled: true, specified: true);
|
||||
}
|
||||
if (value == '0' ||
|
||||
value == 'false' ||
|
||||
value == 'no' ||
|
||||
value == 'n' ||
|
||||
value == 'off') {
|
||||
return (enabled: false, specified: true);
|
||||
}
|
||||
return (enabled: false, specified: false);
|
||||
}
|
||||
|
||||
static bool debugEnabled({
|
||||
required String? appEnv,
|
||||
required String? productionDebugFlag,
|
||||
}) {
|
||||
final flag = parseOptionalBoolFlag(productionDebugFlag);
|
||||
if (flag.specified) {
|
||||
return flag.enabled;
|
||||
}
|
||||
if (!isProductionEnv(appEnv)) {
|
||||
return true;
|
||||
}
|
||||
return parseBoolFlag(productionDebugFlag);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool shouldRelayClientLog({
|
||||
|
||||
Reference in New Issue
Block a user