@@ -648,7 +648,8 @@ func (j *Journal) getData(field string) (unsafe.Pointer, C.int, error) {
648
648
}
649
649
650
650
// 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.
652
653
func (j * Journal ) GetData (field string ) (string , error ) {
653
654
d , l , err := j .getData (field )
654
655
if err != nil {
@@ -659,7 +660,9 @@ func (j *Journal) GetData(field string) (string, error) {
659
660
}
660
661
661
662
// 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.
663
666
func (j * Journal ) GetDataValue (field string ) (string , error ) {
664
667
val , err := j .GetData (field )
665
668
if err != nil {
@@ -670,7 +673,8 @@ func (j *Journal) GetDataValue(field string) (string, error) {
670
673
}
671
674
672
675
// 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.
674
678
func (j * Journal ) GetDataBytes (field string ) ([]byte , error ) {
675
679
d , l , err := j .getData (field )
676
680
if err != nil {
@@ -681,7 +685,9 @@ func (j *Journal) GetDataBytes(field string) ([]byte, error) {
681
685
}
682
686
683
687
// 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.
685
691
func (j * Journal ) GetDataValueBytes (field string ) ([]byte , error ) {
686
692
val , err := j .GetDataBytes (field )
687
693
if err != nil {
@@ -691,9 +697,10 @@ func (j *Journal) GetDataValueBytes(field string) ([]byte, error) {
691
697
return bytes .SplitN (val , []byte ("=" ), 2 )[1 ], nil
692
698
}
693
699
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.
697
704
func (j * Journal ) GetEntry () (* JournalEntry , error ) {
698
705
sd_journal_get_realtime_usec , err := getFunction ("sd_journal_get_realtime_usec" )
699
706
if err != nil {
@@ -802,8 +809,10 @@ func (j *Journal) SetDataThreshold(threshold uint64) error {
802
809
return nil
803
810
}
804
811
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.
807
816
func (j * Journal ) GetRealtimeUsec () (uint64 , error ) {
808
817
var usec C.uint64_t
809
818
@@ -823,7 +832,10 @@ func (j *Journal) GetRealtimeUsec() (uint64, error) {
823
832
return uint64 (usec ), nil
824
833
}
825
834
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.
827
839
func (j * Journal ) GetMonotonicUsec () (uint64 , error ) {
828
840
var usec C.uint64_t
829
841
var boot_id C.sd_id128_t
@@ -844,7 +856,9 @@ func (j *Journal) GetMonotonicUsec() (uint64, error) {
844
856
return uint64 (usec ), nil
845
857
}
846
858
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.
848
862
func (j * Journal ) GetCursor () (string , error ) {
849
863
sd_journal_get_cursor , err := getFunction ("sd_journal_get_cursor" )
850
864
if err != nil {
@@ -894,7 +908,8 @@ func (j *Journal) TestCursor(cursor string) error {
894
908
}
895
909
896
910
// 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.
898
913
func (j * Journal ) SeekHead () error {
899
914
sd_journal_seek_head , err := getFunction ("sd_journal_seek_head" )
900
915
if err != nil {
@@ -913,7 +928,8 @@ func (j *Journal) SeekHead() error {
913
928
}
914
929
915
930
// 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.
917
933
func (j * Journal ) SeekTail () error {
918
934
sd_journal_seek_tail , err := getFunction ("sd_journal_seek_tail" )
919
935
if err != nil {
@@ -932,7 +948,8 @@ func (j *Journal) SeekTail() error {
932
948
}
933
949
934
950
// 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.
936
953
func (j * Journal ) SeekRealtimeUsec (usec uint64 ) error {
937
954
sd_journal_seek_realtime_usec , err := getFunction ("sd_journal_seek_realtime_usec" )
938
955
if err != nil {
@@ -950,7 +967,9 @@ func (j *Journal) SeekRealtimeUsec(usec uint64) error {
950
967
return nil
951
968
}
952
969
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.
954
973
func (j * Journal ) SeekCursor (cursor string ) error {
955
974
sd_journal_seek_cursor , err := getFunction ("sd_journal_seek_cursor" )
956
975
if err != nil {
@@ -1075,7 +1094,9 @@ func (j *Journal) GetUniqueValues(field string) ([]string, error) {
1075
1094
return result , nil
1076
1095
}
1077
1096
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.
1079
1100
func (j * Journal ) GetCatalog () (string , error ) {
1080
1101
sd_journal_get_catalog , err := getFunction ("sd_journal_get_catalog" )
1081
1102
if err != nil {
0 commit comments