Skip to content

Commit ae4d6ae

Browse files
authored
Bring Logging samples up to standard. (GoogleCloudPlatform#183)
1 parent 47baf19 commit ae4d6ae

17 files changed

+1187
-460
lines changed

Diff for: logging/README.md

+53-21
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ Web Services.
1212

1313
* [Setup](#setup)
1414
* [Samples](#samples)
15-
* [Reading logs](#reading-logs)
16-
* [Writing logs](#writing-logs)
17-
* [Exporting logs](#exporting-logs)
15+
* [Logs](#logs)
16+
* [Sinks](#sinks)
1817
* [Error Reporting on Compute Engine](#error-reporting-on-compute-engine)
1918
* [Logging to Google Cloud with Winston](https://github.com/GoogleCloudPlatform/winston-gae)
2019

@@ -30,38 +29,71 @@ Web Services.
3029

3130
## Samples
3231

33-
### Reading logs
32+
### Logs
3433

35-
View the [documentation][read_docs] or the [source code][read_code].
34+
View the [documentation][logs_docs] or the [source code][logs_code].
3635

37-
__Run the sample:__
36+
__Usage:__ `node logs --help`
3837

39-
node list
38+
```
39+
Commands:
40+
list List log entries in the authenticated project.
41+
write <name> <resource> <entry> Write a log entry.
42+
delete <name> Delete a Log.
4043
41-
[read_docs]: https://cloud.google.com/logging/docs/api/tasks/authorization
42-
[read_code]: list.js
44+
Options:
45+
--help Show help [boolean]
4346
44-
### Writing logs
47+
Examples:
48+
node logs list List all log entires.
49+
node logs list -f "severity = ERROR" -s List up to 2 error entries, sorted by
50+
"timestamp" -l 2 timestamp ascending.
51+
node logs write my-log Write a log entry.
52+
'{"type":"gae_app","labels":{"module_id":"default"
53+
}}' '{"message":"Hello World!"}'
54+
node logs delete my-log Delete "my-log".
4555
46-
View the [documentation][write_docs] or the [source code][write_code].
56+
For more information, see https://cloud.google.com/logging/docs
57+
```
4758

48-
__Run the sample:__
59+
[logs_docs]: https://cloud.google.com/logging/docs
60+
[logs_code]: logs.js
4961

50-
node write
62+
### Sinks
5163

52-
[write_docs]: https://cloud.google.com/logging/docs/api/tasks/creating-logs
53-
[write_code]: write.js
64+
View the [documentation][sinks_docs] or the [source code][sinks_code].
5465

55-
### Exporting logs
66+
__Usage:__ `node sinks --help`
5667

57-
View the [documentation][export_docs] or the [source code][export_code].
68+
```
69+
Commands:
70+
create <name> <destination> Create a new sink with the given name and destination.
71+
get <name> Get the metadata for the specified sink.
72+
list List all sinks in the authenticated project.
73+
update <name> <metadata> Update the metadata for the specified sink.
74+
delete <name> Delete the specified sink.
5875
59-
__Run the sample:__
76+
Options:
77+
--help Show help [boolean]
6078
61-
node export
79+
Examples:
80+
node sinks create my-sink my-bucket --type bucket Create a new sink named "my-sink" that exports
81+
logs to a Cloud Storage bucket.
82+
node sinks create my-sink my-dataset --type Create a new sink named "my-sink" that exports
83+
dataset logs to a BigQuery dataset.
84+
node sinks create my-sink my-topic --type topic Create a new sink named "my-sink" that exports
85+
logs to a Cloud Pub/Sub topic.
86+
node sinks get my-sink Get the metadata for "my-sink".
87+
node sinks list List all sinks in the authenticated project.
88+
node sinks update my-sink '{"filter":"severity > Update the specified sink.
89+
ALERT"}'
90+
node sinks delete my-sink Delete "my-sink".
6291
63-
[export_docs]: https://cloud.google.com/logging/docs/api/tasks/exporting-logs
64-
[export_code]: export.js
92+
For more information, see https://cloud.google.com/logging/docs
93+
```
94+
95+
[sinks_docs]: https://cloud.google.com/logging/docs
96+
[sinks_code]: sinks.js
6597

6698
### Error Reporting on Compute Engine
6799

Diff for: logging/export.js

-127
This file was deleted.

Diff for: logging/list.js

-57
This file was deleted.

0 commit comments

Comments
 (0)