in action/log/logadapter/elasticsearch.go [98:125]
func processSearchHits(searchResult *elastic.SearchResult, currency *Currency) error {
if len(searchResult.Hits.Hits) == 0 {
return fmt.Errorf("no documents found")
}
for _, hit := range searchResult.Hits.Hits {
var doc map[string]interface{}
if err := json.Unmarshal(hit.Source, &doc); err != nil {
return fmt.Errorf("failed to unmarshal document: %w", err)
}
// Pretty print the document content
for key, value := range doc {
if key == currency.Index {
if strings.Contains(value.(string), "INFO") {
tool.Logger.Info(fmt.Sprintf("%v", value))
}
if strings.Contains(value.(string), "ERROR") {
tool.Logger.Error(fmt.Sprintf("%v", value))
}
if strings.Contains(value.(string), "WARN") {
tool.Logger.Warn(fmt.Sprintf("%v", value))
}
}
}
}
return nil
}