4
4
5
5
namespace Yokai \Batch \Sources \Tests \Symfony \App \Job \Country ;
6
6
7
+ use Psr \Log \LoggerInterface ;
7
8
use Symfony \Component \HttpKernel \KernelInterface ;
8
9
use Yokai \Batch \Bridge \OpenSpout \Writer \FlatFileWriter ;
9
10
use Yokai \Batch \Bridge \Symfony \Framework \JobWithStaticNameInterface ;
@@ -56,14 +57,18 @@ final class CountryJob extends AbstractDecoratedJob implements
56
57
private ItemWriterInterface $ writer ;
57
58
private array $ countries = [];
58
59
private bool $ flushed = false ;
60
+ private LoggerInterface $ yokaiBatchLogger ;
59
61
60
62
public static function getJobName (): string
61
63
{
62
64
return 'country ' ;
63
65
}
64
66
65
- public function __construct (JobExecutionStorageInterface $ executionStorage , KernelInterface $ kernel )
66
- {
67
+ public function __construct (
68
+ JobExecutionStorageInterface $ executionStorage ,
69
+ KernelInterface $ kernel ,
70
+ LoggerInterface $ yokaiBatchLogger
71
+ ) {
67
72
$ writePath = fn (string $ format ) => new StaticValueParameterAccessor (
68
73
ARTIFACT_DIR . '/symfony/country/countries. ' . $ format
69
74
);
@@ -81,6 +86,7 @@ public function __construct(JobExecutionStorageInterface $executionStorage, Kern
81
86
new FlatFileWriter ($ writePath ('csv ' ), null , null , $ headers ),
82
87
new JsonLinesWriter ($ writePath ('jsonl ' )),
83
88
]);
89
+ $ this ->yokaiBatchLogger = $ yokaiBatchLogger ;
84
90
85
91
parent ::__construct (
86
92
new ItemJob (
@@ -95,6 +101,8 @@ public function __construct(JobExecutionStorageInterface $executionStorage, Kern
95
101
96
102
public function process (mixed $ item ): array
97
103
{
104
+ $ this ->yokaiBatchLogger ->log ('info ' , 'log process ' );
105
+
98
106
return ['iso2 ' => $ item ['code ' ], $ item ['_key ' ] => $ item ['value ' ]];
99
107
}
100
108
0 commit comments