From 586b720fd5d01dc2deee91b685ee628679990080 Mon Sep 17 00:00:00 2001 From: Luna Chen Date: Wed, 21 Mar 2018 19:26:42 +0000 Subject: [PATCH] added link to readthedocs documentations --- README.rst | 142 +----------------- docs/_build/html/.doctrees/environment.pickle | Bin 10739 -> 10716 bytes .../html/.doctrees/guide/advanceD.doctree | Bin 19038 -> 19040 bytes .../html/.doctrees/guide/quickstart.doctree | Bin 24913 -> 24915 bytes docs/_build/html/.doctrees/index.doctree | Bin 9412 -> 9414 bytes 5 files changed, 4 insertions(+), 138 deletions(-) diff --git a/README.rst b/README.rst index 2c4f699..12d825c 100644 --- a/README.rst +++ b/README.rst @@ -51,143 +51,9 @@ You can do the same with classes too: pretty nice right? :) -Installation ------------- - -To install logme: - -.. code-block:: bash - - $ pip3 install logme - - -Specifications --------------- - -Getting Started -~~~~~~~~~~~~~~~ -To get logme started, you will need to cd into your project root and type: - -.. code-block:: bash - - $ logme init - -Then you will see a configuration file 'logme.ini', it looks like this: - -.. code-block:: ini - - [logme] - level = DEBUG - formatter = {asctime} - {name} - {levelname} - {message} - StreamHandler = - active: True - level: DEBUG - FileHandler = - active: True - level: DEBUG - filename: None - NullHandler = - active: False - level: NOTSET - -And this is where you configure your loggers, and each block of configuration are independent, -you can have as many of them as you like. - -**level** and **formatter** are at the master level handler configurations. This means if the level and formatter on -each handler are not specified, the handlers will use the master level ones. To customize each handler, -simple edit the logme.ini file. - - -To add a config, do this: - -.. code-block:: bash - - $ logme add my_configuration_here - - -Using Logger in Your Project -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -*logme.log()* can accepts 3 optional arguments for customize your logger: - * scope: the scope of your logger: *class*, *function* or *module*. You can omit this parameter for class and - function. **this is required for module level logger** - * config: the name of logging config specified in logme.ini, default would be the *logme* config - * name: the name of the logger, default would be the __name__ of the file where you are calling logme.ini - - -**logging for functions and methods** -For functions, you can simple just decorate the function/method in which you want to use the logger, like so: - -.. code-block:: python - - @logme.log(config='my_custom_conf', name='custom_test_logger') - def dummy_function_custom(name, logger=None): - logger.info('test function logger with custom params') - - return logger, name - - -*Be sure to pass in the "logger" as a keyword argument, and you can assign it to None when defining the function* - - -**logging for classes** -For classes, you can also use the decorator, and an attribute *self.logger* will be available. - -.. code-block:: python - - @logme.log - class MyAwesomeClass: - def my_function(self, my_arg): - self.logger.info('this is my log message') - - - -**logging for modules** -Logging modules is slightly different from classes and functions, but it's just as straight forward. -*and remember, scope keyword argument must be passed in* - -.. code-block:: python - - module_logger = logme.log(scope='module', name='my_module_logger') - - -Advanced Usage - Delegation ---------------------------- - -Assuming you are making a distributed package, and you still want to include logging, -but you want to give the user the freedom to configure the logger. Follow these steps: - -1. Have only the NullHandler active in your project root logme.ini file. -2. In your __init__.py file, make a module logger, like so: - -.. code-block:: python - - logger = logme.log(scope='module') - -3. Import this logger throughout your project. -4. When user need to see the logging messages, they can then import the logger and change the configuration. - -.. code-block:: python - - from your_project import logger - - # assuming if the importer also has logme installed and initialized - logger.reset_configuration(config_name='my_own_logger') - - # if not, a configuration dictionary can also be passed in this format: - config = { - "level": "DEBUG", - "format": "{levelname}: {message}", - "StreamHandler": { - "level": "DEBUG", - }, - "FileHandler": { - "level": "DEBUG", - "filename": "/var/log/mylog.log", - }, - } - - } - logger.reset_configuration(config=config) +Documentation +------------- +You can find the documentation at http://logme.readthedocs.io/en/latest/ . +Give it a try! diff --git a/docs/_build/html/.doctrees/environment.pickle b/docs/_build/html/.doctrees/environment.pickle index bc72d300aa253d9b52f2a01fe35e24ebf7c46c26..8b3f807b73ed883a5f5eba0af21dbb6b3881e7aa 100644 GIT binary patch delta 693 zcmewyd?%Qtfo1B&i7c*yVa`@Dp~b01#W9i28L4>&rj!538&2$05OlyIVX*NK61 z(a1=4cf7VHN8)lULq-yWc|AZsBL%{|x$e^B6Rd5lNwrflQYHtpy<$w7Y{wqUm@;_| z`#jd9j5!%8o9#JvaZcuxbDeA_6fpU&0^j60Lbri5|K>Jf7Df|lY- zYs7dUjN{_v5QeX$GK5htr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