I need a simple debug class so I can add to it throughout the running of the app and output it and see a debug trail.

```
class debug {
    public function __construct(){
        $this->debug = '';
    }

    public function set($addition) {
        $this->debug .= $addition .'<br\/>';
    }

    public function get(){
        return $this->debug;
    }
}
$debugUser = new debug();
$debugSystem = new debug();

```

So i now have two objects. Using the following I can now set a trail for debugSystem:

```
$debugSystem->set('System debug instantiated.');

```

However if I create an object from a different class I cannot use the above, to add to 

```
$debugSystem->debug;

```

For example:

```
class user {
    public function __construct() {
        $debugSystem->set('The class 'user' has been created.');
    }
}
$user = new user;

```

This new now gives me an error. Where am I going wrong? And is there a better way of doing this?