Package etl :: Package component :: Package transform :: Module logger
[hide private]
[frames] | no frames]

Source Code for Module etl.component.transform.logger

 1  # -*- encoding: utf-8 -*- 
 2  ############################################################################## 
 3  # 
 4  #    ETL system- Extract Transfer Load system 
 5  #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved 
 6  #    $Id$ 
 7  # 
 8  #    This program is free software: you can redistribute it and/or modify 
 9  #    it under the terms of the GNU General Public License as published by 
10  #    the Free Software Foundation, either version 3 of the License, or 
11  #    (at your option) any later version. 
12  # 
13  #    This program is distributed in the hope that it will be useful, 
14  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  #    GNU General Public License for more details. 
17  # 
18  #    You should have received a copy of the GNU General Public License 
19  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
20  # 
21  ############################################################################## 
22  """ 
23   To display log detail in streamline. 
24   
25   Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).  
26   GNU General Public License. 
27  """ 
28   
29  from etl.component import component 
30  import sys 
31 -class logger(component):
32 """ 33 This is an ETL Component that use to display log detail in streamline. 34 35 Type : Data Component. 36 Computing Performance : Streamline. 37 Input Flows : 0-x. 38 * .* : The main data flow with input data. 39 Output Flows : 0-y. 40 * .* : Returns the main flow. 41 """
42 - def __init__(self, output=sys.stdout, name='component.transfer.logger'):
43 super(logger, self).__init__(name=name) 44 self._type = 'component.transfer.logger' 45 self.output = output
46
47 - def __copy__(self):
48 res = logger(self.output, self.name) 49 return res
50
51 - def process(self):
52 for channel,trans in self.input_get().items(): 53 for iterator in trans: 54 for d in iterator: 55 self.output.write('Log ' + self.name + ' ' + str(d) + '\n') 56 yield d, 'main' 57