Пример #1
0
        internal static void Init()
        {
            if (Program.LaunchParameters.ContainsKey("-build"))
            {
                return;
            }

            if (!Directory.Exists(LogDir))
            {
                Directory.CreateDirectory(LogDir);
            }

            ConfigureAppenders();

            tML.InfoFormat("Starting {0} {1} {2}", ModLoader.versionedName, ReLogic.OS.Platform.Current.Type, side);
            tML.InfoFormat("Running on {0} {1}", FrameworkVersion.Framework, FrameworkVersion.Version);
            tML.InfoFormat("Executable: {0}", Assembly.GetEntryAssembly().Location);
            tML.InfoFormat("Working Directory: {0}", Path.GetFullPath(Directory.GetCurrentDirectory()));
            tML.InfoFormat("Launch Parameters: {0}", string.Join(" ", Program.LaunchParameters.Select(p => (p.Key + " " + p.Value).Trim())));

            if (ModCompile.DeveloperMode)
            {
                tML.Info("Developer mode enabled");
            }

            AppDomain.CurrentDomain.UnhandledException += (s, args) => tML.Error("Unhandled Exception", args.ExceptionObject as Exception);
            LogFirstChanceExceptions();
            EnablePortablePDBTraces();
            AssemblyResolving.Init();
            LoggingHooks.Init();
            LogArchiver.ArchiveLogs();
        }
Пример #2
0
    public Db(IDbConnection connection, DbOptions options, ILogger logger)
    {
        Options = options ?? new DbOptions();
        if (Options.Dialect == DbDialect.Auto)
        {
            Options.Dialect = ResolveDialect(connection);
        }

        if (logger == null)
        {
            Connection = connection;
        }
        else
        {
            var hooks = new LoggingHooks(logger, options);
            Connection = new AnetDbConnection(connection as DbConnection, hooks)
            {
                MetricsEnabled = options.EnableMetrics
            };
        }

        Logger = logger;
    }
Пример #3
0
        internal static void Init()
        {
            if (Program.LaunchParameters.ContainsKey("-build"))
            {
                return;
            }

            // This is the first file we attempt to use.
            Utils.TryCreatingDirectory(LogDir);

            ConfigureAppenders();

            tML.InfoFormat("Starting tModLoader {0} {1}", side, BuildInfo.BuildIdentifier);
            tML.InfoFormat("Log date: {0}", DateTime.Now.ToString("d"));
            tML.InfoFormat("Running on {0} {1} {2}", ReLogic.OS.Platform.Current.Type, FrameworkVersion.Framework, FrameworkVersion.Version);
            tML.InfoFormat("Executable: {0}", Assembly.GetEntryAssembly().Location);
            tML.InfoFormat("Working Directory: {0}", Path.GetFullPath(Directory.GetCurrentDirectory()));
            tML.InfoFormat("Launch Parameters: {0}", string.Join(" ", Program.LaunchParameters.Select(p => (p.Key + " " + p.Value).Trim())));

            if (ModCompile.DeveloperMode)
            {
                tML.Info("Developer mode enabled");
            }

            foreach (var line in initWarnings)
            {
                tML.Warn(line);
            }

            AppDomain.CurrentDomain.UnhandledException += (s, args) => tML.Error("Unhandled Exception", args.ExceptionObject as Exception);
            LogFirstChanceExceptions();
            EnablePortablePDBTraces();
            AssemblyResolving.Init();
            LoggingHooks.Init();
            LogArchiver.ArchiveLogs();
        }