
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include <systemd/sd-journal.h>

#include <stdlib.h> // for getenv
#include <string.h> // for strcmp

int is_debug_enabled()
{
    static int enabled = -1;
    if (enabled == -1) {
        // Check if environment variable DDE_DEBUG_LEVEL is set to "debug"
        const char *env = getenv("DDE_DEBUG_LEVEL");
        enabled = (env != NULL && strcmp(env, "debug") == 0) ? 1 : 0;
    }
    return enabled;
}
