         # Keeps track of state and runs certain state-transition tasks
         oldState = @__state
         if not newState?
-            console.log "oldState requested"
             return oldState
         if newState not in ['stopped', 'starting', 'running']
             throw new Error("Invalid state #{newState}")
-        console.log "#{oldState} -> #{newState}"
+        @log 'state', "#{oldState} -> #{newState}"
         @__state = newState
 
         # state-transition tasks

    stop: =>
        # Kills the server process, and all its children (such as those spawned
        # by e.g. Django's autoreloader or a shell script w/o exec).
        console.log "#{@name}: stop requested"
        if @process?
            psTree @process.pid, (err, children) =>
                for child in children

                    callback()
            @readyCallbacks = []

    log: (feature, msg) ->
        console.log "[#{@name} #{feature}] #{msg}"

module.exports =
    ServiceManager: ServiceManager
    Service: Service
