Commits

Alexandre Macabies committed 3101f38

Fixed logging

Comments (0)

Files changed (1)

minecraft/setup.py

                     RES_CFG['resources']['media_url'] + path).content)
             logging.debug("Downloaded resource: %s (%d bytes)", path, size)
 
+    logging.info("Successfully downloaded all Minecraft resources")
+
 
 def write_servers_dat():
     nbtfile = NBTFile()
     prolocraft.tags.append(TAG_String(name='ip', value=RES_CFG['server']['host']))
     root.tags.append(prolocraft)
     nbtfile.tags.append(root)
-    nbtfile.write_file(
-        buffer=open(os.path.join(RES_CFG['resources']['static_dir'], 'servers.dat'), 'wb'))
+    with open(os.path.join(RES_CFG['resources']['static_dir'], 'servers.dat'), 'wb') as f:
+        nbtfile.write_file(buffer=f)
+        logging.info("Wrote %s" % f.name)
 
 
 if __name__ == '__main__':
+    prologin.log.setup_logging('minecraft-setup')
     write_servers_dat()
     download_resources()