diff options
| author | Doug Hellmann <doug@doughellmann.com> | 2017-06-13 15:55:33 -0400 |
|---|---|---|
| committer | Andreas Jaeger <aj@suse.com> | 2017-06-23 11:54:32 +0200 |
| commit | 9599ffe65d9dcd4b3aa780d346eccd1e760890bf (patch) | |
| tree | 9281e521e50b8bed66eca087bc11fa03adf2aed3 /doc/source/command-logs.rst | |
| parent | 19c8cabeca1ea3c83da734ab5269318b27eb5634 (diff) | |
| download | python-openstackclient-9599ffe65d9dcd4b3aa780d346eccd1e760890bf.tar.gz | |
reorganize existing documentation according to the new standard layout
Move existing content around based on the doc-migration specification.
Replace :doc: markup with :ref: to have sphinx keep track of where the
files move and generate valid hyperlinks.
Add a few toctrees and index pages for the new directories.
Depends-On: Ia750cb049c0f53a234ea70ce1f2bbbb7a2aa9454
Change-Id: I253ee8f89d3ec40e39310c18bb87ed1d3d5de330
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Diffstat (limited to 'doc/source/command-logs.rst')
| -rw-r--r-- | doc/source/command-logs.rst | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/doc/source/command-logs.rst b/doc/source/command-logs.rst deleted file mode 100644 index 62126510..00000000 --- a/doc/source/command-logs.rst +++ /dev/null @@ -1,73 +0,0 @@ -============ -Command Logs -============ - -Logger usage in OpenStackClient is not exactly the same as those in other -OpenStack projects. The following basic rules should be followed. - -1. OpenStackClient uses python standard logging library instead of oslo.log - so that it will depend on oslo as little as possible. - -2. All logs except debug log need to be translated. The log message strings - that need to be translated should follow the rule of i18n guidelines: - http://docs.openstack.org/developer/oslo.i18n/guidelines.html - -3. There are mainly two kinds of logs in OpenStackClient: command specific - log and general log. Use different logger to record them. The examples - below will show the detail. - -Command specific log -==================== - -Command specific logs are those messages that used to record info, warning -and error generated from a specific command. OpenStackClient uses the logger -of the module the command belongs to to record the command specific logs. - -Example -~~~~~~~ - -This example shows how to log command specific logs in OpenStackClient. - -.. code-block:: python - - import logging - - from openstackclient.i18n import _ - - - LOG = logging.getLogger(__name__) # Get the logger of this module - - ## ... - - LOG.error(_("Error message")) - LOG.warning(_("Warning message")) - LOG.info(_("Info message")) - LOG.debug("Debug message") # Debug messages do not need to be translated - - ## ... - -General log -=========== - -General logs are those messages that not specific to any single command. Use -the logger of ``openstackclient.shell`` to record them. In each command class, -we can simply get this logger by ``self.app.log``. - -Example -~~~~~~~ - -This example shows how to log general logs in OpenStackClient. - -.. code-block:: python - - from openstackclient.i18n import _ - - - ## ... - - self.app.log.error(_("Error message")) - self.app.log.warning(_("Warning message")) - self.app.log.info(_("Info message")) - self.app.log.debug("Debug message") # Debug messages do not need to be translated - - ## ... |
