import diesel
from aspen.server import BaseEngine
from diesel.protocols import wsgi


class Engine(BaseEngine):

    app = None # a diesel app instance

    def bind(self):
        self.app = wsgi.WSGIApplication( self.website
                                       , self.website.address[1]
                                       , self.website.address[0]
                                        )

    def start(self):
        self.app.run()

    def stop(self):
        try:
            self.app.halt()
        except diesel.app.ApplicationEnd:
            pass # Only you can prevent log spam.

    def start_restarter(self, check_all):
        def loop():
            while True:
                check_all()
                diesel.sleep(0.5)
        self.app.add_loop(diesel.Loop(loop))

import diesel
from aspen.server import BaseEngine
from diesel.protocols import wsgi


class Engine(BaseEngine):

    diesel_app = None # a diesel diesel_app instance

    def bind(self):
        self.diesel_app = wsgi.WSGIApplication( self.website
                                              , self.website.address[1]
                                              , self.website.address[0]
                                               )

    def start(self):
        self.diesel_app.run()

    def stop(self):
        try:
            if self.diesel_app is not None:
                self.diesel_app.halt()
        except diesel.app.ApplicationEnd:
            pass # Only you can prevent log spam.

    def start_restarter(self, check_all):
        def loop():
            while True:
                check_all()
                diesel.sleep(0.5)
        self.diesel_app.add_loop(diesel.Loop(loop))

Reduce log spam from diesel.
Reduce log spam from diesel.

  import diesel
  from aspen.server import BaseEngine
  from diesel.protocols import wsgi
  
  
  class Engine(BaseEngine):
  
-     app = None # a diesel app instance
+     diesel_app = None # a diesel diesel_app instance
  
      def bind(self):
-         self.app = wsgi.WSGIApplication( self.website
+         self.diesel_app = wsgi.WSGIApplication( self.website
-                                        , self.website.address[1]
+                                               , self.website.address[1]
-                                        , self.website.address[0]
+                                               , self.website.address[0]
-                                         )
+                                                )
  
      def start(self):
-         self.app.run()
+         self.diesel_app.run()
  
      def stop(self):
          try:
+             if self.diesel_app is not None:
-             self.app.halt()
+                 self.diesel_app.halt()
          except diesel.app.ApplicationEnd:
              pass # Only you can prevent log spam.
  
      def start_restarter(self, check_all):
          def loop():
              while True:
                  check_all()
                  diesel.sleep(0.5)
-         self.app.add_loop(diesel.Loop(loop))
+         self.diesel_app.add_loop(diesel.Loop(loop))
  
Reduce log spam from diesel.
## Code Before:
import diesel
from aspen.server import BaseEngine
from diesel.protocols import wsgi


class Engine(BaseEngine):

    app = None # a diesel app instance

    def bind(self):
        self.app = wsgi.WSGIApplication( self.website
                                       , self.website.address[1]
                                       , self.website.address[0]
                                        )

    def start(self):
        self.app.run()

    def stop(self):
        try:
            self.app.halt()
        except diesel.app.ApplicationEnd:
            pass # Only you can prevent log spam.

    def start_restarter(self, check_all):
        def loop():
            while True:
                check_all()
                diesel.sleep(0.5)
        self.app.add_loop(diesel.Loop(loop))

## Instruction:
Reduce log spam from diesel.
## Code After:
import diesel
from aspen.server import BaseEngine
from diesel.protocols import wsgi


class Engine(BaseEngine):

    diesel_app = None # a diesel diesel_app instance

    def bind(self):
        self.diesel_app = wsgi.WSGIApplication( self.website
                                              , self.website.address[1]
                                              , self.website.address[0]
                                               )

    def start(self):
        self.diesel_app.run()

    def stop(self):
        try:
            if self.diesel_app is not None:
                self.diesel_app.halt()
        except diesel.app.ApplicationEnd:
            pass # Only you can prevent log spam.

    def start_restarter(self, check_all):
        def loop():
            while True:
                check_all()
                diesel.sleep(0.5)
        self.diesel_app.add_loop(diesel.Loop(loop))
