Code help

I'm creating a little plugin that outputs some html. Here's what I got so far. Displays the html on all blogs except the main one. What/Where do I need to add code so that it doesn't display to logged in users.

if ( !defined("ABSPATH") ) {
     die("I don't think so, Tim.");
}

global $blog_id;

if ( $blog_id == 1 ) {
     return;
}

function test_function () { ?>

<!--HTML CODE HERE -->

<?php }

add_action('wp_footer', test_function');

Thanks