import xml.etree.cElementTree as ET


class AccountManager:

    def __init__(self, login_email=None, password=None):
        self.login_email = login_email
        self.password = password

    def save_account_credentials(self):
        root = ET.Element("account")
        doc = ET.SubElement(root, "credentials")
        i = 0

        ET.SubElement(doc, "login_email").text = str(self.login_email)
        ET.SubElement(doc, "password").text = str(self.password)
        ET.SubElement(doc, "logged_in").text = str("1")
        tree = ET.ElementTree(root)
        tree.write("storj_account_conf.xml")

    def if_logged_in(self):
        logged_in = "0"
        try:
            et = ET.parse("storj_account_conf.xml")
            for tags in et.iter('logged_in'):
                logged_in = tags.text
        except:
            logged_in = "0"
            print "Error in Account Manager login"

        if logged_in == "1":
            return True
        else:
            return False

    def logout(self):
        print 1

    def get_user_password(self):
        password = ""
        try:
            et = ET.parse("storj_account_conf.xml")
            for tags in et.iter('password'):
                password = tags.text
        except:
            print "Error in Account Manager get password"
        return password

    def get_user_email(self):
        email = ""
        try:
            et = ET.parse("storj_account_conf.xml")
            for tags in et.iter('login_email'):
                email = tags.text
        except:
            print "Error in Account Manager get email"
        return email
        print 1

@@ -29,16 +29,88 @@
 e as ET%0A
+from log_manager import logger%0A%0AACCOUNT_FILE = %22storj_account_conf.xml%22%0A
 %0A%0Aclass 
@@ -385,22 +385,8 @@
 ls%22)
-%0A        i = 0
 %0A%0A  
@@ -570,16 +570,11 @@
 t = 
-str(
 %221%22
-)
 %0A   
@@ -672,32 +672,111 @@
 ogged_in(self):%0A
+        %22%22%22Return True if user has already logged in with these credentials%22%22%22%0A
         logged_i
@@ -938,32 +938,40 @@
 t%0A        except
+ IOError
 :%0A            lo
@@ -988,38 +988,45 @@
 %220%22%0A            
-print 
+logger.error(
 %22Error in Accoun
@@ -1041,16 +1041,151 @@
 r login%22
+)%0A            logger.error(%22Function: if_logged_in%22)%0A            logger.error(%22Credentials file not existing%22)%0A            return False
 %0A%0A      
@@ -1301,23 +1301,62 @@
         
-print 1
+logger.debug(%22TODO%22)%0A        logger.debug(%221%22)
 %0A%0A    de
@@ -1557,32 +1557,40 @@
 t%0A        except
+ IOError
 :%0A            pr
@@ -1579,38 +1579,45 @@
 or:%0A            
-print 
+logger.error(
 %22Error in Accoun
@@ -1639,16 +1639,75 @@
 assword%22
+)%0A            logger.error(%22Credentials file not existing%22)
 %0A       
@@ -1934,16 +1934,24 @@
   except
+ IOError
 :%0A      
@@ -1956,22 +1956,29 @@
         
-print 
+logger.error(
 %22Error i
@@ -2005,16 +2005,17 @@
 t email%22
+)
 %0A       
@@ -2019,33 +2019,75 @@
     
-return email%0A        print 1
+    logger.error(%22Credentials file not existing%22)%0A        return email
 %0A

add logger to account manager