/// <summary> /// 注册所有需要使用的包 /// </summary> /// <param name="RequireManager"></param> /// <param name="options"></param> public static void Register(RequireManager RequireManager, TabrisOptions options = null) { //tabris RequireManager.RegisterPackage(new TabrisPackage()); //sql SqlPackageHelpers.RegisterPackage(RequireManager, options?.DbExecutor ?? new AntOrmDbExecutor()); //http HttpPackageHelpers.RegisterPackage(RequireManager); //log LogPackageHelpers.RegisterPackage(RequireManager, options?.LogExecutor); }
public async void TestLog1() { var subject = new TestObject(); var manager = new RuntimeManager(new ManualManagerSettings { ScriptTimeoutMilliSeconds = 0 }); LogPackageHelpers.RegisterPackage(manager.RequireManager); var options = new ExecutionOptions(); options.HostObjects.Add(new HostObject { Name = "subject", Target = subject }); var code = "var logFactory = require('javascript_log_factory');" + "var log = this.logFactory.create({trace:true});" + //"subject.StatusCode = content.ExecuteNonQuery(\"update school set address ='1' where id = 1\");"; "try{ aa.ttt =1}catch(err){log.info(err)}"; await manager.ExecuteAsync("testScript", code, options); }