2 #Copyright (C) 2009-2010 :
3 # Gabes Jean, naparuba@gmail.com
4 # Gerhard Lausser, Gerhard.Lausser@consol.de
6 #This file is part of Shinken.
8 #Shinken is free software: you can redistribute it and/or modify
9 #it under the terms of the GNU Affero 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.
13 #Shinken 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 Affero General Public License for more details.
18 #You should have received a copy of the GNU Affero General Public License
19 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
28 #We load the object where we will put log broks
29 #with the 'add' method
30 def load_obj(self
, obj
, name
= None):
34 #We enter a log message, we format it, and we add the log brok
35 def log(self
, message
, format
= None):
39 #We format the log in UTF-8
40 s
= u
'[%d] %s\n' % (int(time
.time()), message
.decode('UTF-8', 'replace'))
42 s
= u
'[%d] [%s] %s\n' % (int(time
.time()), self
.name
, message
.decode('UTF-8', 'replace'))
46 #Wecreate and add the brok
47 b
= Brok('log', {'log' : s
})