📝 Add documentation for nested fields
This commit is contained in:
parent
fbcec20221
commit
91c5b3ad15
1 changed files with 36 additions and 0 deletions
36
README.md
36
README.md
|
|
@ -73,6 +73,42 @@ As JSON, that would be:
|
|||
}]
|
||||
```
|
||||
|
||||
#### Nested fields
|
||||
|
||||
This format also supports deeper structures. Of course, you can use raw JSON, like this:
|
||||
|
||||
```
|
||||
@begin February 3, 2015 at 01:33PM - Check-in at Piggly Wiggly
|
||||
@metadata {"lat":"33.6798911","lng":"-84.3959460","shop":"supermarket","osm_id":11617197123,"osm_type":"node","copyright":"The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."}
|
||||
@url https://www.openstreetmap.org/node/11617197123 @end
|
||||
```
|
||||
|
||||
This becomes exactly what you expect:
|
||||
|
||||
```json
|
||||
{
|
||||
"title":"Check-in at Piggly Wiggly",
|
||||
"date":"2015-02-03T13:33:00Z",
|
||||
"metadata":{"lat":"33.6798911","lng":"-84.3959460","shop":"supermarket","osm_id":11617197123,"osm_type":"node","copyright":"The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."},
|
||||
"url":"https://www.openstreetmap.org/node/11617197123"
|
||||
}
|
||||
```
|
||||
|
||||
This `metadata` field is a bit clunky, though. We can expand it into multiple fields for better readability:
|
||||
|
||||
```
|
||||
@begin February 3, 2015 at 01:33PM - Check-in at Piggly Wiggly
|
||||
@metadata:lat 33.6798911
|
||||
@metadata:lng -84.3959460
|
||||
@metadata:shop supermarket
|
||||
@metadata:osm_id 11617197123
|
||||
@metadata:osm_type node
|
||||
@metadata:copyright The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.
|
||||
@url https://www.openstreetmap.org/node/11617197123 @end
|
||||
```
|
||||
|
||||
In addition to improving readability, it may be more suitable for generation by other tools.
|
||||
|
||||
### Adding log entries
|
||||
|
||||
As was previously noted, the idea is that you can figure out the best way for you to add to the log file. But, `my-log` also comes with a command to add them from the command line. Run `my-log drop --help` for instructions on how to use it. But, here's a few examples:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue