SetLevel() public static method

public static SetLevel ( string logLevel ) : void
logLevel string
return void
Example #1
0
        public static bool Init()
        {
            Logger.Init(Path.Combine(HOBD.AppPath, "log.txt"));

            try{
                int handle = FindWindow(null, HomePage.Title);
                if (handle != 0)
                {
                    Logger.log("INFO", "HOBD", "App bring to foreground", null);
                    SetForegroundWindow(handle);
                    return(false);
                }
            }catch (Exception e) {}

            try{
                Logger.log("INFO", "HOBD", "App start", null);

                try{
                    config = new ConfigData(Path.Combine(HOBD.AppPath, "config.xml"));
                }catch (Exception e) {
                    Logger.error("HOBD", "failure loading config.xml, using defaults", e);
                    config = new ConfigData();
                }

                Logger.SetLevel(config.LogLevel);

                ReloadLang();

                ReloadUnits();

                ReloadVehicle();

                int dpi_value;

                var bwidth = Screen.PrimaryScreen.Bounds.Width;
                if (bwidth > 1920)
                {
                    bwidth = 800;
                }

                dpi_value = (int)(96f / bwidth * 480f);

                Logger.trace("HOBD", "Bounds.Width: " + bwidth);

                if (config.DPI != 0)
                {
                    dpi_value = config.DPI;
                }
                FleuxApplication.TargetDesignDpi = dpi_value;

                ReloadTheme();
            }catch (Exception e) {
                Logger.error("HOBD", "fatal failure, exiting", e);
                if (engine != null && engine.IsActive())
                {
                    engine.Deactivate();
                }
                return(false);
            }
            return(true);
        }