Skip to content

Commit bdd9c44

Browse files
docs: update docs (googleapis#77)
- update branding - remove docs for auto-generated library
1 parent bf579e4 commit bdd9c44

File tree

13 files changed

+76
-101
lines changed

13 files changed

+76
-101
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,6 @@
292292
- Upgrading to `google-cloud-core >= 0.28.0` and adding dependency
293293
on `google-api-core` (#4221, #4280)
294294
- Deferring to `google-api-core` for `grpcio` and
295-
`googleapis-common-protos`dependencies (#4096, #4098)
295+
`googleapis-common-protos` dependencies (#4096, #4098)
296296

297297
PyPI: https://pypi.org/project/google-cloud-logging/1.4.0/

README.rst

Lines changed: 5 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Logging configuration.
1616
.. _Cloud Logging API: https://cloud.google.com/logging
1717
.. _Client Library Documentation: https://googleapis.dev/python/logging/latest
1818
.. _Product Documentation: https://cloud.google.com/logging/docs
19+
.. _Setting Up Cloud Logging for Python: https://cloud.google.com/logging/docs/setup/python
20+
.. _Python's standard logging library: https://docs.python.org/2/library/logging.html
1921

2022
Quick Start
2123
-----------
@@ -74,60 +76,11 @@ Windows
7476
<your-env>\Scripts\activate
7577
<your-env>\Scripts\pip.exe install google-cloud-logging
7678
77-
Using the API
78-
-------------
79-
80-
.. code:: python
81-
82-
from google.cloud import logging_v2
83-
client = logging_v2.LoggingServiceV2Client()
84-
85-
resource = {
86-
"type": "global",
87-
"labels": {
88-
"project_id": "[PROJECT_ID]"
89-
}
90-
}
91-
92-
"""
93-
Log entries can be either LogEntry or dict.
94-
You can describe the same data in the following format:
95-
96-
e = {
97-
"log_name": "projects/[PROJECT_ID]/logs/test-logging",
98-
"resource": resource,
99-
"text_payload": "this is a log statement",
100-
}
101-
"""
102-
e = logging_v2.types.LogEntry(
103-
log_name="projects/[PROJECT_ID]/logs/test-logging", # optional
104-
resource=resource, # optional
105-
text_payload="this is a log statement")
106-
107-
entries = [e]
108-
response = client.write_log_entries(entries)
109-
110-
.. code:: python
111-
112-
from google.cloud import logging
113-
client = logging.Client()
114-
logger = client.logger('log_name')
115-
logger.log_text('A simple entry') # API call
116-
117-
Example of fetching entries:
118-
119-
.. code:: python
120-
121-
from google.cloud import logging
122-
client = logging.Client()
123-
logger = client.logger('log_name')
124-
for entry in logger.list_entries():
125-
print(entry.payload)
126-
12779
Next Steps
12880
~~~~~~~~~~
12981

82+
- Read the `Setting Up Cloud Logging for Python`_ How-to Guide
83+
- Read the `Product documentation`_ to learn more about the product and see
84+
other How-to Guides.
13085
- Read the `Client Library Documentation`_ for to see other available
13186
methods on the client.
132-
- Read the `Product documentation`_ to learn more about the product and see
133-
How-to Guides.

docs/conf.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
2121
sys.path.insert(0, os.path.abspath(".."))
2222

23+
# For plugins that can not read conf.py.
24+
# See also: https://github.com/docascode/sphinx-docfx-yaml/issues/85
25+
sys.path.insert(0, os.path.abspath("."))
26+
2327
__version__ = ""
2428

2529
# -- General configuration ------------------------------------------------
2630

2731
# If your documentation needs a minimal Sphinx version, state it here.
28-
needs_sphinx = "1.6.3"
32+
needs_sphinx = "1.5.5"
2933

3034
# Add any Sphinx extension module names here, as strings. They can be
3135
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -35,24 +39,22 @@
3539
"sphinx.ext.autosummary",
3640
"sphinx.ext.intersphinx",
3741
"sphinx.ext.coverage",
42+
"sphinx.ext.doctest",
3843
"sphinx.ext.napoleon",
3944
"sphinx.ext.todo",
4045
"sphinx.ext.viewcode",
46+
"recommonmark",
4147
]
4248

4349
# autodoc/autosummary flags
4450
autoclass_content = "both"
45-
autodoc_default_flags = ["members"]
51+
autodoc_default_options = {"members": True}
4652
autosummary_generate = True
4753

4854

4955
# Add any paths that contain templates here, relative to this directory.
5056
templates_path = ["_templates"]
5157

52-
# Allow markdown includes (so releases.md can include CHANGLEOG.md)
53-
# http://www.sphinx-doc.org/en/master/markdown.html
54-
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
55-
5658
# The suffix(es) of source filenames.
5759
# You can specify multiple suffix as a list of string:
5860
# source_suffix = ['.rst', '.md']
@@ -93,7 +95,12 @@
9395

9496
# List of patterns, relative to source directory, that match files and
9597
# directories to ignore when looking for source files.
96-
exclude_patterns = ["_build"]
98+
exclude_patterns = [
99+
"_build",
100+
"samples/AUTHORING_GUIDE.md",
101+
"samples/CONTRIBUTING.md",
102+
"samples/snippets/README.rst",
103+
]
97104

98105
# The reST default role (used for this markup: `text`) to use for all
99106
# documents.

docs/gapic/v2/api.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/gapic/v2/types.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/handlers-container-engine.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Google Container Engine Log Handler
2-
===================================
1+
Google Kubernetes Engine Log Handler
2+
====================================
33

44
.. automodule:: google.cloud.logging.handlers.container_engine
55
:members:

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Documentation
55
.. toctree::
66
:maxdepth: 3
77

8-
v1
98
v2
109

1110
Changelog

docs/snippets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""Testable usage examples for Stackdriver Logging API wrapper
15+
"""Testable usage examples for Cloud Logging API wrapper
1616
1717
Each example function takes a ``client`` argument (which must be an instance
1818
of :class:`google.cloud.logging.client.Client`) and uses it to perform a task

docs/usage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ logging handler can use different transports. The default is
336336
direct API call on each logging statement to write the entry.
337337

338338

339-
.. _Google Container Engine: https://cloud.google.com/container-engine/
339+
.. _Google Kubernetes Engine: https://cloud.google.com/kubernetes-engine
340340

341341
fluentd logging handlers
342342
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -347,7 +347,7 @@ which writes directly to the API, two other handlers are provided.
347347
recommended when running on the Google App Engine Flexible vanilla runtimes
348348
(i.e. your app.yaml contains ``runtime: python``), and
349349
:class:`~google.cloud.logging.handlers.container_engine.ContainerEngineHandler`
350-
, which is recommended when running on `Google Container Engine`_ with the
350+
, which is recommended when running on `Google Kubernetes Engine`_ with the
351351
Cloud Logging plugin enabled.
352352

353353
:meth:`~google.cloud.logging.client.Client.get_default_handler` and
@@ -356,6 +356,6 @@ the environment to automatically detect whether the code is running in
356356
these platforms and use the appropriate handler.
357357

358358
In both cases, the fluentd agent is configured to automatically parse log files
359-
in an expected format and forward them to Cloud logging. The handlers
359+
in an expected format and forward them to Cloud Logging. The handlers
360360
provided help set the correct metadata such as log level so that logs can be
361361
filtered accordingly.

docs/v1.rst

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/v2.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,16 @@ v2
33
.. toctree::
44
:maxdepth: 2
55

6-
gapic/v2/api
7-
gapic/v2/types
6+
usage
7+
client
8+
logger
9+
entries
10+
metric
11+
sink
12+
stdlib-usage
13+
handlers
14+
handlers-app-engine
15+
handlers-container-engine
16+
transports-sync
17+
transports-thread
18+
transports-base

noxfile.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,48 @@ def cover(session):
152152
def docs(session):
153153
"""Build the docs for this library."""
154154

155+
session.install('-e', '.')
156+
session.install('sphinx', 'alabaster', 'recommonmark')
157+
158+
shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True)
159+
session.run(
160+
'sphinx-build',
161+
'-W', # warnings as errors
162+
'-T', # show full traceback on exception
163+
'-N', # no colors
164+
'-b', 'html',
165+
'-d', os.path.join('docs', '_build', 'doctrees', ''),
166+
os.path.join('docs', ''),
167+
os.path.join('docs', '_build', 'html', ''),
168+
)
169+
170+
171+
@nox.session(python="3.7")
172+
def docfx(session):
173+
"""Build the docfx yaml files for this library."""
174+
155175
session.install("-e", ".")
156-
session.install("sphinx<3.0.0", "alabaster", "recommonmark")
176+
# sphinx-docfx-yaml supports up to sphinx version 1.5.5.
177+
# https://github.com/docascode/sphinx-docfx-yaml/issues/97
178+
session.install("sphinx==1.5.5", "alabaster", "recommonmark", "sphinx-docfx-yaml")
157179

158180
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
159181
session.run(
160182
"sphinx-build",
161-
"-W", # warnings as errors
162183
"-T", # show full traceback on exception
163184
"-N", # no colors
185+
"-D",
186+
(
187+
"extensions=sphinx.ext.autodoc,"
188+
"sphinx.ext.autosummary,"
189+
"docfx_yaml.extension,"
190+
"sphinx.ext.intersphinx,"
191+
"sphinx.ext.coverage,"
192+
"sphinx.ext.napoleon,"
193+
"sphinx.ext.todo,"
194+
"sphinx.ext.viewcode,"
195+
"recommonmark"
196+
),
164197
"-b",
165198
"html",
166199
"-d",

synth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434

3535
s.move(library / "google/cloud/logging_v2/gapic")
3636
s.move(library / "tests/unit/gapic/v2")
37-
s.move(library / "docs/gapic/v2")
37+
# Don't include gapic library docs. Users should use the hand-written layer instead
38+
# s.move(library / "docs/gapic/v2")
3839

3940
# ----------------------------------------------------------------------------
4041
# Add templated files

0 commit comments

Comments
 (0)