# Path: mlpy/modules/patterns.py
# class Singleton(type):
#     """
#     Metaclass ensuring only one instance of the class exists.
# 
#     The singleton pattern ensures that a class has only one instance
#     and provides a global point of access to that instance.
# 
#     Methods
#     -------
#     __call__
# 
#     Notes
#     -----
#     To define a class as a singleton include the :data:`__metaclass__`
#     directive.
# 
#     See Also
#     --------
#     :class:`Borg`
# 
#     Examples
#     --------
#     Define a singleton class:
# 
#     >>> from mlpy.modules.patterns import Singleton
#     >>> class MyClass(object):
#     >>>     __metaclass__ = Singleton
# 
#     .. note::
#         | Project: Code from `StackOverflow <http://stackoverflow.com/q/6760685>`_.
#         | Code author: `theheadofabroom <http://stackoverflow.com/users/655372/theheadofabroom>`_
#         | License: `CC-Wiki <http://creativecommons.org/licenses/by-sa/3.0/>`_
# 
#     """
#     _instance = {}
# 
#     def __call__(cls, *args, **kwargs):
#         """Returns instance to object."""
#         if cls not in cls._instance:
#             # noinspection PyArgumentList
#             cls._instance[cls] = super(Singleton, cls).__call__(*args, **kwargs)
#         return cls._instance[cls]


import os
import logging
from datetime import datetime
from ..modules.patterns import Singleton

    See Also
    --------
    :mod:`logging`

    Examples
    --------
    >>> from mlpy.tools.log import LoggingMgr
    >>> logger = LoggingMgr().get_logger('my_id')
    >>> logger.info('This is a useful information.')

    This gets a new logger. If a logger with the module id `my_id` already exists
    that logger will be returned, otherwise a logger with the default settings is
    created.

    >>> LoggingMgr().add_handler('my_id', htype=LoggingMgr.LOG_TYPE_FILE)

    This adds a new handler for the logger with module id `my_id` writing the logs
    to a file.

    >>> LoggingMgr().remove_handler('my_id', htype=LoggingMgr.LOG_TYPE_STREAM)

    This removes the stream handler from the logger with module id `my_id`.

    >>> LoggingMgr().change_level('my_id', LoggingMgr.LOG_TYPE_ALL, LoggingMgr.LOG_DEBUG)

    This changes the log level for all attached handlers of the logger identified by
    `my_id` to LOG_DEBUG.

    """

# Path: mlpy/modules/patterns.py
# class Singleton(type):
#     """
#     Metaclass ensuring only one instance of the class exists.
# 
#     The singleton pattern ensures that a class has only one instance
#     and provides a global point of access to that instance.
# 
#     Methods
#     -------
#     __call__
# 
#     Notes
#     -----
#     To define a class as a singleton include the :data:`__metaclass__`
#     directive.
# 
#     See Also
#     --------
#     :class:`Borg`
# 
#     Examples
#     --------
#     Define a singleton class:
# 
#     >>> from mlpy.modules.patterns import Singleton
#     >>> class MyClass(object):
#     >>>     __metaclass__ = Singleton
# 
#     .. note::
#         | Project: Code from `StackOverflow <http://stackoverflow.com/q/6760685>`_.
#         | Code author: `theheadofabroom <http://stackoverflow.com/users/655372/theheadofabroom>`_
#         | License: `CC-Wiki <http://creativecommons.org/licenses/by-sa/3.0/>`_
# 
#     """
#     _instance = {}
# 
#     def __call__(cls, *args, **kwargs):
#         """Returns instance to object."""
#         if cls not in cls._instance:
#             # noinspection PyArgumentList
#             cls._instance[cls] = super(Singleton, cls).__call__(*args, **kwargs)
#         return cls._instance[cls]


# Path: mlpy/tools/log.py
import os
import logging
from datetime import datetime
from ..modules.patterns import Singleton


    See Also
    --------
    :mod:`logging`

    Examples
    --------
    >>> from mlpy.tools.log import LoggingMgr
    >>> logger = LoggingMgr().get_logger('my_id')
    >>> logger.info('This is a useful information.')

    This gets a new logger. If a logger with the module id `my_id` already exists
    that logger will be returned, otherwise a logger with the default settings is
    created.

    >>> LoggingMgr().add_handler('my_id', htype=LoggingMgr.LOG_TYPE_FILE)

    This adds a new handler for the logger with module id `my_id` writing the logs
    to a file.

    >>> LoggingMgr().remove_handler('my_id', htype=LoggingMgr.LOG_TYPE_STREAM)

    This removes the stream handler from the logger with module id `my_id`.

    >>> LoggingMgr().change_level('my_id', LoggingMgr.LOG_TYPE_ALL, LoggingMgr.LOG_DEBUG)

    This changes the log level for all attached handlers of the logger identified by
    `my_id` to LOG_DEBUG.

    """

    __metaclass__ = Singleton