# Path: nowtrade/logger.py
# CRITICAL = logging.CRITICAL
# ERROR = logging.ERROR
# WARNING = logging.WARNING
# INFO = logging.INFO
# DEBUG = logging.DEBUG
# class Logger(object):
#     def __init__(self, name, log_file=configuration.LOG_FILE, \
#                  console_lvl=configuration.LOGGING_DEFAULT_CONSOLE, \
#                  file_lvl=configuration.LOGGING_DEFAULT_FILE):
#     def get_logger_level(self, name, default, out):
#     def get_console_level(self, name, default):
#     def get_file_level(self, name, default):
#     def set_file_level(self, lvl):
#     def set_console_level(self, lvl):
#     def debug(self, message):
#     def info(self, message):
#     def warning(self, message):
#     def error(self, message):
#     def critical(self, message):
#     def exception(self, message):
#     def __getstate__(self):
#     def __setstate__(self, data):


import smtplib
from nowtrade import logger
    """
    The base notification class.
    """
    pass

class SMTPNotification(Notification):
    """
    SMTP-based email notifications.
    """
    def __init__(self, username, password, recipient, server='smtp.gmail.com', port=587):
        self.username = username
        self.password = password
        self.recipient = recipient
        self.server = server
        self.port = port
        self.session = self._get_session()
        self.headers = None
        self.body = None
        self.logger = logger.Logger(self.__class__.__name__)
        self.logger.info('username: %s  password: *  recipient: %s  server: %s  port: %s'
                         %(username, recipient, server, port))

    def send(self, subject, body):
        """
        Sends the email out with the specified subject and body.
        """
        self.logger.info('Sending email to %s' %self.recipient)
        self.headers = self._get_headers(subject)
        self.body = body
        self.logger.debug('Headers: %s' %self.headers)

# Path: nowtrade/logger.py
# CRITICAL = logging.CRITICAL
# ERROR = logging.ERROR
# WARNING = logging.WARNING
# INFO = logging.INFO
# DEBUG = logging.DEBUG
# class Logger(object):
#     def __init__(self, name, log_file=configuration.LOG_FILE, \
#                  console_lvl=configuration.LOGGING_DEFAULT_CONSOLE, \
#                  file_lvl=configuration.LOGGING_DEFAULT_FILE):
#     def get_logger_level(self, name, default, out):
#     def get_console_level(self, name, default):
#     def get_file_level(self, name, default):
#     def set_file_level(self, lvl):
#     def set_console_level(self, lvl):
#     def debug(self, message):
#     def info(self, message):
#     def warning(self, message):
#     def error(self, message):
#     def critical(self, message):
#     def exception(self, message):
#     def __getstate__(self):
#     def __setstate__(self, data):


# Path: nowtrade/notification.py
import smtplib
from nowtrade import logger

    """
    The base notification class.
    """
    pass

class SMTPNotification(Notification):
    """
    SMTP-based email notifications.
    """
    def __init__(self, username, password, recipient, server='smtp.gmail.com', port=587):
        self.username = username
        self.password = password
        self.recipient = recipient
        self.server = server
        self.port = port
        self.session = self._get_session()
        self.headers = None
        self.body = None
        self.logger = logger.Logger(self.__class__.__name__)
        self.logger.info('username: %s  password: *  recipient: %s  server: %s  port: %s'
                         %(username, recipient, server, port))

    def send(self, subject, body):
        """
        Sends the email out with the specified subject and body.
        """
        self.logger.info('Sending email to %s' %self.recipient)
        self.headers = self._get_headers(subject)
        self.body = body
        self.logger.debug('Headers: %s' %self.headers)

        self.logger.debug('Body: %s' %self.body)