@@ -641,7 +641,8 @@ func (j *Journal) getData(field string) (unsafe.Pointer, C.int, error) {
641641}
642642
643643// GetData gets the data object associated with a specific field from the
644- // current journal entry.
644+ // the journal entry referenced by the last completed Next/Previous function
645+ // call. To call GetData, you must have first called one of these functions.
645646func (j * Journal ) GetData (field string ) (string , error ) {
646647 d , l , err := j .getData (field )
647648 if err != nil {
@@ -652,7 +653,9 @@ func (j *Journal) GetData(field string) (string, error) {
652653}
653654
654655// GetDataValue gets the data object associated with a specific field from the
655- // current journal entry, returning only the value of the object.
656+ // journal entry referenced by the last completed Next/Previous function call,
657+ // returning only the value of the object. To call GetDataValue, you must first
658+ // have called one of the Next/Previous functions.
656659func (j * Journal ) GetDataValue (field string ) (string , error ) {
657660 val , err := j .GetData (field )
658661 if err != nil {
@@ -663,7 +666,8 @@ func (j *Journal) GetDataValue(field string) (string, error) {
663666}
664667
665668// GetDataBytes gets the data object associated with a specific field from the
666- // current journal entry.
669+ // journal entry referenced by the last completed Next/Previous function call.
670+ // To call GetDataBytes, you must first have called one of these functions.
667671func (j * Journal ) GetDataBytes (field string ) ([]byte , error ) {
668672 d , l , err := j .getData (field )
669673 if err != nil {
@@ -674,7 +678,9 @@ func (j *Journal) GetDataBytes(field string) ([]byte, error) {
674678}
675679
676680// GetDataValueBytes gets the data object associated with a specific field from the
677- // current journal entry, returning only the value of the object.
681+ // journal entry referenced by the last completed Next/Previous function call,
682+ // returning only the value of the object. To call GetDataValueBytes, you must first
683+ // have called one of the Next/Previous functions.
678684func (j * Journal ) GetDataValueBytes (field string ) ([]byte , error ) {
679685 val , err := j .GetDataBytes (field )
680686 if err != nil {
@@ -684,9 +690,10 @@ func (j *Journal) GetDataValueBytes(field string) ([]byte, error) {
684690 return bytes .SplitN (val , []byte ("=" ), 2 )[1 ], nil
685691}
686692
687- // GetEntry returns a full representation of a journal entry with
688- // all key-value pairs of data as well as address fields (cursor, realtime
689- // timestamp and monotonic timestamp)
693+ // GetEntry returns a full representation of the journal entry referenced by the
694+ // last completed Next/Previous function call, with all key-value pairs of data
695+ // as well as address fields (cursor, realtime timestamp and monotonic timestamp).
696+ // To call GetEntry, you must first have called one of the Next/Previous functions.
690697func (j * Journal ) GetEntry () (* JournalEntry , error ) {
691698 sd_journal_get_realtime_usec , err := getFunction ("sd_journal_get_realtime_usec" )
692699 if err != nil {
@@ -795,8 +802,10 @@ func (j *Journal) SetDataThreshold(threshold uint64) error {
795802 return nil
796803}
797804
798- // GetRealtimeUsec gets the realtime (wallclock) timestamp of the current
799- // journal entry.
805+ // GetRealtimeUsec gets the realtime (wallclock) timestamp of the journal
806+ // entry referenced by the last completed Next/Previous function call. To
807+ // call GetRealtimeUsec, you must first have called one of the Next/Previous
808+ // functions.
800809func (j * Journal ) GetRealtimeUsec () (uint64 , error ) {
801810 var usec C.uint64_t
802811
@@ -816,7 +825,10 @@ func (j *Journal) GetRealtimeUsec() (uint64, error) {
816825 return uint64 (usec ), nil
817826}
818827
819- // GetMonotonicUsec gets the monotonic timestamp of the current journal entry.
828+ // GetMonotonicUsec gets the monotonic timestamp of the journal entry
829+ // referenced by the last completed Next/Previous function call. To call
830+ // GetMonotonicUsec, you must first have called one of the Next/Previous
831+ // functions.
820832func (j * Journal ) GetMonotonicUsec () (uint64 , error ) {
821833 var usec C.uint64_t
822834 var boot_id C.sd_id128_t
@@ -837,7 +849,9 @@ func (j *Journal) GetMonotonicUsec() (uint64, error) {
837849 return uint64 (usec ), nil
838850}
839851
840- // GetCursor gets the cursor of the current journal entry.
852+ // GetCursor gets the cursor of the last journal entry reeferenced by the
853+ // last completed Next/Previous function call. To call GetCursor, you must
854+ // first have called one of the Next/Previous functions.
841855func (j * Journal ) GetCursor () (string , error ) {
842856 sd_journal_get_cursor , err := getFunction ("sd_journal_get_cursor" )
843857 if err != nil {
@@ -885,7 +899,8 @@ func (j *Journal) TestCursor(cursor string) error {
885899}
886900
887901// SeekHead seeks to the beginning of the journal, i.e. the oldest available
888- // entry.
902+ // entry. This call must be followed by a call to Next before any call to
903+ // Get* will return data about the first element.
889904func (j * Journal ) SeekHead () error {
890905 sd_journal_seek_head , err := getFunction ("sd_journal_seek_head" )
891906 if err != nil {
@@ -904,7 +919,8 @@ func (j *Journal) SeekHead() error {
904919}
905920
906921// SeekTail may be used to seek to the end of the journal, i.e. the most recent
907- // available entry.
922+ // available entry. This call must be followed by a call to Next before any
923+ // call to Get* will return data about the last element.
908924func (j * Journal ) SeekTail () error {
909925 sd_journal_seek_tail , err := getFunction ("sd_journal_seek_tail" )
910926 if err != nil {
@@ -923,7 +939,8 @@ func (j *Journal) SeekTail() error {
923939}
924940
925941// SeekRealtimeUsec seeks to the entry with the specified realtime (wallclock)
926- // timestamp, i.e. CLOCK_REALTIME.
942+ // timestamp, i.e. CLOCK_REALTIME. This call must be followed by a call to
943+ // Next/Previous before any call to Get* will return data about the sought entry.
927944func (j * Journal ) SeekRealtimeUsec (usec uint64 ) error {
928945 sd_journal_seek_realtime_usec , err := getFunction ("sd_journal_seek_realtime_usec" )
929946 if err != nil {
@@ -941,7 +958,9 @@ func (j *Journal) SeekRealtimeUsec(usec uint64) error {
941958 return nil
942959}
943960
944- // SeekCursor seeks to a concrete journal cursor.
961+ // SeekCursor seeks to a concrete journal cursor. This call must be
962+ // followed by a call to Next/Previous before any call to Get* will return
963+ // data about the sought entry.
945964func (j * Journal ) SeekCursor (cursor string ) error {
946965 sd_journal_seek_cursor , err := getFunction ("sd_journal_seek_cursor" )
947966 if err != nil {
@@ -1066,7 +1085,9 @@ func (j *Journal) GetUniqueValues(field string) ([]string, error) {
10661085 return result , nil
10671086}
10681087
1069- // GetCatalog retrieves a message catalog entry for the current journal entry.
1088+ // GetCatalog retrieves a message catalog entry for the journal entry referenced
1089+ // by the last completed Next/Previous function call. To call GetCatalog, you
1090+ // must first have called one of these functions.
10701091func (j * Journal ) GetCatalog () (string , error ) {
10711092 sd_journal_get_catalog , err := getFunction ("sd_journal_get_catalog" )
10721093 if err != nil {
0 commit comments