@@ -641,7 +641,8 @@ func (j *Journal) getData(field string) (unsafe.Pointer, C.int, error) {
641
641
}
642
642
643
643
// 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.
645
646
func (j * Journal ) GetData (field string ) (string , error ) {
646
647
d , l , err := j .getData (field )
647
648
if err != nil {
@@ -652,7 +653,9 @@ func (j *Journal) GetData(field string) (string, error) {
652
653
}
653
654
654
655
// 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.
656
659
func (j * Journal ) GetDataValue (field string ) (string , error ) {
657
660
val , err := j .GetData (field )
658
661
if err != nil {
@@ -663,7 +666,8 @@ func (j *Journal) GetDataValue(field string) (string, error) {
663
666
}
664
667
665
668
// 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.
667
671
func (j * Journal ) GetDataBytes (field string ) ([]byte , error ) {
668
672
d , l , err := j .getData (field )
669
673
if err != nil {
@@ -674,7 +678,9 @@ func (j *Journal) GetDataBytes(field string) ([]byte, error) {
674
678
}
675
679
676
680
// 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.
678
684
func (j * Journal ) GetDataValueBytes (field string ) ([]byte , error ) {
679
685
val , err := j .GetDataBytes (field )
680
686
if err != nil {
@@ -684,9 +690,10 @@ func (j *Journal) GetDataValueBytes(field string) ([]byte, error) {
684
690
return bytes .SplitN (val , []byte ("=" ), 2 )[1 ], nil
685
691
}
686
692
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.
690
697
func (j * Journal ) GetEntry () (* JournalEntry , error ) {
691
698
sd_journal_get_realtime_usec , err := getFunction ("sd_journal_get_realtime_usec" )
692
699
if err != nil {
@@ -795,8 +802,10 @@ func (j *Journal) SetDataThreshold(threshold uint64) error {
795
802
return nil
796
803
}
797
804
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.
800
809
func (j * Journal ) GetRealtimeUsec () (uint64 , error ) {
801
810
var usec C.uint64_t
802
811
@@ -816,7 +825,10 @@ func (j *Journal) GetRealtimeUsec() (uint64, error) {
816
825
return uint64 (usec ), nil
817
826
}
818
827
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.
820
832
func (j * Journal ) GetMonotonicUsec () (uint64 , error ) {
821
833
var usec C.uint64_t
822
834
var boot_id C.sd_id128_t
@@ -837,7 +849,9 @@ func (j *Journal) GetMonotonicUsec() (uint64, error) {
837
849
return uint64 (usec ), nil
838
850
}
839
851
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.
841
855
func (j * Journal ) GetCursor () (string , error ) {
842
856
sd_journal_get_cursor , err := getFunction ("sd_journal_get_cursor" )
843
857
if err != nil {
@@ -885,7 +899,8 @@ func (j *Journal) TestCursor(cursor string) error {
885
899
}
886
900
887
901
// 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.
889
904
func (j * Journal ) SeekHead () error {
890
905
sd_journal_seek_head , err := getFunction ("sd_journal_seek_head" )
891
906
if err != nil {
@@ -904,7 +919,8 @@ func (j *Journal) SeekHead() error {
904
919
}
905
920
906
921
// 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.
908
924
func (j * Journal ) SeekTail () error {
909
925
sd_journal_seek_tail , err := getFunction ("sd_journal_seek_tail" )
910
926
if err != nil {
@@ -923,7 +939,8 @@ func (j *Journal) SeekTail() error {
923
939
}
924
940
925
941
// 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.
927
944
func (j * Journal ) SeekRealtimeUsec (usec uint64 ) error {
928
945
sd_journal_seek_realtime_usec , err := getFunction ("sd_journal_seek_realtime_usec" )
929
946
if err != nil {
@@ -941,7 +958,9 @@ func (j *Journal) SeekRealtimeUsec(usec uint64) error {
941
958
return nil
942
959
}
943
960
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.
945
964
func (j * Journal ) SeekCursor (cursor string ) error {
946
965
sd_journal_seek_cursor , err := getFunction ("sd_journal_seek_cursor" )
947
966
if err != nil {
@@ -1066,7 +1085,9 @@ func (j *Journal) GetUniqueValues(field string) ([]string, error) {
1066
1085
return result , nil
1067
1086
}
1068
1087
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.
1070
1091
func (j * Journal ) GetCatalog () (string , error ) {
1071
1092
sd_journal_get_catalog , err := getFunction ("sd_journal_get_catalog" )
1072
1093
if err != nil {
0 commit comments