Skip to content

Commit

Permalink
Merge pull request #28 from JohannesKonings/header-tiem-log
Browse files Browse the repository at this point in the history
header/item for BAL and GELF
  • Loading branch information
Goala authored Oct 22, 2020
2 parents c5fd280 + c359642 commit a06cadf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/zcl_ale_log_converter_gelf.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ CLASS zcl_ale_log_converter_gelf IMPLEMENTATION.
DATA(gelf_json) = |\{| &&
|"version": "1.1",| &&
|"host": "{ sy-host }",| &&
|"short_message": "{ 'dummy' }",| &&
|"full_message": "{ <log>-text }",| &&
|"short_message": "{ <log>-header_text }",| &&
|"full_message": "{ <log>-item_text }",| &&
|"level": { level },| &&
|"_user_id": "{ sy-uname }",| &&
|"_some_info": "foo",| &&
Expand Down
15 changes: 9 additions & 6 deletions src/zcl_ale_log_reader_bal.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ CLASS zcl_ale_log_reader_bal IMPLEMENTATION.
t_exceptions = exceptions.

DATA log_entry TYPE string.
LOOP AT messages ASSIGNING FIELD-SYMBOL(<message>).
LOOP AT header_data ASSIGNING FIELD-SYMBOL(<header_data>).
LOOP AT messages ASSIGNING FIELD-SYMBOL(<message>) WHERE lognumber = <header_data>-lognumber.

MESSAGE ID <message>-msgid TYPE <message>-msgty NUMBER <message>-msgno
WITH <message>-msgv1 <message>-msgv2 <message>-msgv3 <message>-msgv4
INTO log_entry.
MESSAGE ID <message>-msgid TYPE <message>-msgty NUMBER <message>-msgno
WITH <message>-msgv1 <message>-msgv2 <message>-msgv3 <message>-msgv4
INTO log_entry.

logs = VALUE #( BASE logs ( level = <message>-msgty
text = log_entry ) ).
logs = VALUE #( BASE logs ( level = <message>-msgty
header_text = |{ <header_data>-extnumber } / { <header_data>-object } / { <header_data>-subobject }|
item_text = log_entry ) ).

ENDLOOP.
ENDLOOP.

ENDMETHOD.
Expand Down
5 changes: 3 additions & 2 deletions src/zif_ale_log_reader.intf.abap
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ INTERFACE zif_ale_log_reader
TYPES ty_filter_values TYPE STANDARD TABLE OF ty_filter_value.

TYPES: BEGIN OF ty_log,
level TYPE c LENGTH 1,
text TYPE string,
level TYPE c LENGTH 1,
header_text TYPE string,
item_text TYPE string,
END OF ty_log.

TYPES ty_logs TYPE STANDARD TABLE OF ty_log WITH DEFAULT KEY.
Expand Down

0 comments on commit a06cadf

Please sign in to comment.