@@ -648,7 +648,8 @@ func (j *Journal) getData(field string) (unsafe.Pointer, C.int, error) {
648648}
649649
650650// GetData gets the data object associated with a specific field from the
651- // current journal entry.
651+ // the journal entry referenced by the last completed Next/Previous function
652+ // call. To call GetData, you must have first called one of these functions.
652653func (j * Journal ) GetData (field string ) (string , error ) {
653654 d , l , err := j .getData (field )
654655 if err != nil {
@@ -659,7 +660,9 @@ func (j *Journal) GetData(field string) (string, error) {
659660}
660661
661662// GetDataValue gets the data object associated with a specific field from the
662- // current journal entry, returning only the value of the object.
663+ // journal entry referenced by the last completed Next/Previous function call,
664+ // returning only the value of the object. To call GetDataValue, you must first
665+ // have called one of the Next/Previous functions.
663666func (j * Journal ) GetDataValue (field string ) (string , error ) {
664667 val , err := j .GetData (field )
665668 if err != nil {
@@ -670,7 +673,8 @@ func (j *Journal) GetDataValue(field string) (string, error) {
670673}
671674
672675// GetDataBytes gets the data object associated with a specific field from the
673- // current journal entry.
676+ // journal entry referenced by the last completed Next/Previous function call.
677+ // To call GetDataBytes, you must first have called one of these functions.
674678func (j * Journal ) GetDataBytes (field string ) ([]byte , error ) {
675679 d , l , err := j .getData (field )
676680 if err != nil {
@@ -681,7 +685,9 @@ func (j *Journal) GetDataBytes(field string) ([]byte, error) {
681685}
682686
683687// GetDataValueBytes gets the data object associated with a specific field from the
684- // current journal entry, returning only the value of the object.
688+ // journal entry referenced by the last completed Next/Previous function call,
689+ // returning only the value of the object. To call GetDataValueBytes, you must first
690+ // have called one of the Next/Previous functions.
685691func (j * Journal ) GetDataValueBytes (field string ) ([]byte , error ) {
686692 val , err := j .GetDataBytes (field )
687693 if err != nil {
@@ -691,9 +697,10 @@ func (j *Journal) GetDataValueBytes(field string) ([]byte, error) {
691697 return bytes .SplitN (val , []byte ("=" ), 2 )[1 ], nil
692698}
693699
694- // GetEntry returns a full representation of a journal entry with
695- // all key-value pairs of data as well as address fields (cursor, realtime
696- // timestamp and monotonic timestamp)
700+ // GetEntry returns a full representation of the journal entry referenced by the
701+ // last completed Next/Previous function call, with all key-value pairs of data
702+ // as well as address fields (cursor, realtime timestamp and monotonic timestamp).
703+ // To call GetEntry, you must first have called one of the Next/Previous functions.
697704func (j * Journal ) GetEntry () (* JournalEntry , error ) {
698705 sd_journal_get_realtime_usec , err := getFunction ("sd_journal_get_realtime_usec" )
699706 if err != nil {
@@ -802,8 +809,10 @@ func (j *Journal) SetDataThreshold(threshold uint64) error {
802809 return nil
803810}
804811
805- // GetRealtimeUsec gets the realtime (wallclock) timestamp of the current
806- // journal entry.
812+ // GetRealtimeUsec gets the realtime (wallclock) timestamp of the journal
813+ // entry referenced by the last completed Next/Previous function call. To
814+ // call GetRealtimeUsec, you must first have called one of the Next/Previous
815+ // functions.
807816func (j * Journal ) GetRealtimeUsec () (uint64 , error ) {
808817 var usec C.uint64_t
809818
@@ -823,7 +832,10 @@ func (j *Journal) GetRealtimeUsec() (uint64, error) {
823832 return uint64 (usec ), nil
824833}
825834
826- // GetMonotonicUsec gets the monotonic timestamp of the current journal entry.
835+ // GetMonotonicUsec gets the monotonic timestamp of the journal entry
836+ // referenced by the last completed Next/Previous function call. To call
837+ // GetMonotonicUsec, you must first have called one of the Next/Previous
838+ // functions.
827839func (j * Journal ) GetMonotonicUsec () (uint64 , error ) {
828840 var usec C.uint64_t
829841 var boot_id C.sd_id128_t
@@ -844,7 +856,9 @@ func (j *Journal) GetMonotonicUsec() (uint64, error) {
844856 return uint64 (usec ), nil
845857}
846858
847- // GetCursor gets the cursor of the current journal entry.
859+ // GetCursor gets the cursor of the last journal entry reeferenced by the
860+ // last completed Next/Previous function call. To call GetCursor, you must
861+ // first have called one of the Next/Previous functions.
848862func (j * Journal ) GetCursor () (string , error ) {
849863 sd_journal_get_cursor , err := getFunction ("sd_journal_get_cursor" )
850864 if err != nil {
@@ -894,7 +908,8 @@ func (j *Journal) TestCursor(cursor string) error {
894908}
895909
896910// SeekHead seeks to the beginning of the journal, i.e. the oldest available
897- // entry.
911+ // entry. This call must be followed by a call to Next before any call to
912+ // Get* will return data about the first element.
898913func (j * Journal ) SeekHead () error {
899914 sd_journal_seek_head , err := getFunction ("sd_journal_seek_head" )
900915 if err != nil {
@@ -913,7 +928,8 @@ func (j *Journal) SeekHead() error {
913928}
914929
915930// SeekTail may be used to seek to the end of the journal, i.e. the most recent
916- // available entry.
931+ // available entry. This call must be followed by a call to Next before any
932+ // call to Get* will return data about the last element.
917933func (j * Journal ) SeekTail () error {
918934 sd_journal_seek_tail , err := getFunction ("sd_journal_seek_tail" )
919935 if err != nil {
@@ -932,7 +948,8 @@ func (j *Journal) SeekTail() error {
932948}
933949
934950// SeekRealtimeUsec seeks to the entry with the specified realtime (wallclock)
935- // timestamp, i.e. CLOCK_REALTIME.
951+ // timestamp, i.e. CLOCK_REALTIME. This call must be followed by a call to
952+ // Next/Previous before any call to Get* will return data about the sought entry.
936953func (j * Journal ) SeekRealtimeUsec (usec uint64 ) error {
937954 sd_journal_seek_realtime_usec , err := getFunction ("sd_journal_seek_realtime_usec" )
938955 if err != nil {
@@ -950,7 +967,9 @@ func (j *Journal) SeekRealtimeUsec(usec uint64) error {
950967 return nil
951968}
952969
953- // SeekCursor seeks to a concrete journal cursor.
970+ // SeekCursor seeks to a concrete journal cursor. This call must be
971+ // followed by a call to Next/Previous before any call to Get* will return
972+ // data about the sought entry.
954973func (j * Journal ) SeekCursor (cursor string ) error {
955974 sd_journal_seek_cursor , err := getFunction ("sd_journal_seek_cursor" )
956975 if err != nil {
@@ -1075,7 +1094,9 @@ func (j *Journal) GetUniqueValues(field string) ([]string, error) {
10751094 return result , nil
10761095}
10771096
1078- // GetCatalog retrieves a message catalog entry for the current journal entry.
1097+ // GetCatalog retrieves a message catalog entry for the journal entry referenced
1098+ // by the last completed Next/Previous function call. To call GetCatalog, you
1099+ // must first have called one of these functions.
10791100func (j * Journal ) GetCatalog () (string , error ) {
10801101 sd_journal_get_catalog , err := getFunction ("sd_journal_get_catalog" )
10811102 if err != nil {
0 commit comments