Class: BulkImports::Logger
- Inherits:
-
Import::Framework::Logger
- Object
- Labkit::Logging::JsonLogger
- Gitlab::JsonLogger
- Import::Framework::Logger
- BulkImports::Logger
- Defined in:
- lib/bulk_imports/logger.rb
Constant Summary collapse
- IMPORTER_NAME =
'gitlab_migration'
Instance Method Summary collapse
- #default_attributes ⇒ Object
- #entity_attributes ⇒ Object
- #tracker_attributes ⇒ Object
-
#with_entity(entity) ⇒ Object
Extract key information from a provided entity and include it in log entries created from this logger instance.
-
#with_tracker(tracker) ⇒ Object
Extract key information from a provided tracker and its entity and include it in log entries created from this logger instance.
Methods inherited from Import::Framework::Logger
Methods inherited from Gitlab::JsonLogger
build, cache_key, debug, error, file_name, file_name_noext, full_log_path, info, warn
Instance Method Details
#default_attributes ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/bulk_imports/logger.rb', line 46 def default_attributes super.merge( { importer: IMPORTER_NAME }, entity_attributes, tracker_attributes ) end |
#entity_attributes ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bulk_imports/logger.rb', line 24 def entity_attributes return {} unless entity { bulk_import_id: entity.bulk_import_id, bulk_import_entity_id: entity.id, bulk_import_entity_type: entity.source_type, source_full_path: entity.source_full_path, source_version: entity.source_version.to_s } end |
#tracker_attributes ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/bulk_imports/logger.rb', line 36 def tracker_attributes return {} unless tracker { tracker_id: tracker.id, pipeline_class: tracker.pipeline_name, tracker_state: tracker.human_status_name } end |
#with_entity(entity) ⇒ Object
Extract key information from a provided entity and include it in log entries created from this logger instance.
10 11 12 13 |
# File 'lib/bulk_imports/logger.rb', line 10 def with_entity(entity) @entity = entity self end |
#with_tracker(tracker) ⇒ Object
Extract key information from a provided tracker and its entity and include it in log entries created from this logger instance.
18 19 20 21 22 |
# File 'lib/bulk_imports/logger.rb', line 18 def with_tracker(tracker) with_entity(tracker.entity) @tracker = tracker self end |