Ignore:
Timestamp:
13 Jul 2015, 08:20:23 (9 years ago)
Author:
Henrik Bettermann
Message:

Adjust logging methods in the various section.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r13133 r13166  
    291291
    292292    def writeLogMessage(view, comment):
    293         """Add an INFO message to the log file.
     293        """Add an INFO message to ``applicants.log``.
    294294        """
    295295
     
    449449
    450450    def writeLogMessage(view, comment):
    451         """Add an INFO message to the log file.
     451        """Add an INFO message to ``applicants.log``.
    452452        """
    453453
  • main/waeup.kofa/trunk/src/waeup/kofa/documents/interfaces.py

    r13145 r13166  
    6363
    6464    def writeLogMessage(view, message):
    65         """Write a view specific log message into main.log.
     65        """Add an INFO message to ``main.log``.
    6666        """
    6767
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py

    r11254 r13166  
    3939from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    4040
    41 def write_log_message(view, message):
    42     ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
    43     view.context.loggerInfo(ob_class, message)
    44     return
    45 
    4641# Save function used for save methods in manager pages
    4742def msave(view, **data):
     
    5449    view.flash(_('Form has been saved.'))
    5550    if fields_string:
    56         write_log_message(view, 'saved: % s' % fields_string)
     51        view.context.writeLogMessage(view, 'saved: %s' % fields_string)
    5752    return
    5853
     
    146141            for id in child_id:
    147142                deleted.append(id)
    148             write_log_message(self, 'deleted: % s' % ', '.join(deleted))
     143            self.context.writeLogMessage(self, 'deleted: % s' % ', '.join(deleted))
    149144        delSubobjects(self, redirect='@@manage', tab='2')
    150145        return
     
    159154        self.context.clearAllHostels()
    160155        self.flash(_('All hostels cleared.'))
    161         write_log_message(self, 'all hostels cleared')
     156        self.context.writeLogMessage(self, 'all hostels cleared')
    162157        self.redirect(self.url(self.context, '@@manage')+'#tab2')
    163158        return
     
    192187            return
    193188        self.flash(_('Hostel created.'))
    194         write_log_message(self, 'added: % s' % data['hostel_name'])
     189        self.context.writeLogMessage(self, 'added: % s' % data['hostel_name'])
    195190        self.redirect(self.url(self.context[hostel.hostel_id], 'index'))
    196191        return
     
    254249            mapping = {'a':removed, 'b':added, 'c':modified, 'd':modified_beds})
    255250        self.flash(flash_message)
    256         write_log_message(self, message)
     251        self.context.writeLogMessage(self, message)
    257252        self.redirect(self.url(self.context, '@@manage')+'#tab2')
    258253        return
     
    284279            self.flash(_('Successfully switched beds: ${a}',
    285280                mapping = {'a':m_translated}))
    286             write_log_message(self, 'switched: %s' % message)
     281            self.context.writeLogMessage(self, 'switched: %s' % message)
    287282            self.redirect(self.url(self.context, '@@manage')+'#tab2')
    288283        return
     
    308303            self.flash(_('Successfully released beds: ${a}',
    309304                mapping = {'a':message}))
    310             write_log_message(self, 'released: %s' % message)
     305            self.context.writeLogMessage(self, 'released: %s' % message)
    311306            self.redirect(self.url(self.context, '@@manage')+'#tab2')
    312307        else:
     
    319314        self.context.clearHostel()
    320315        self.flash(_('Hostel cleared.'))
    321         write_log_message(self, 'cleared')
     316        self.context.writeLogMessage(self, 'cleared')
    322317        self.redirect(self.url(self.context, '@@manage')+'#tab2')
    323318        return
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/container.py

    r13165 r13166  
    5252        return
    5353
    54     logger_name = 'waeup.kofa.${sitename}.hostels'
    55     logger_filename = 'hostels.log'
    56 
    57     def logger_info(self, ob_class, target, comment=None):
    58         """Get the logger's info method.
    59         """
    60         self.logger.info('%s - %s - %s' % (
    61                 ob_class, target, comment))
    62         return
    63 
    64     def loggerInfo(self, ob_class, comment=None):
    65         target = self.__name__
    66         return self.logger_info(ob_class,target,comment)
    67 
    6854    @property
    6955    def expired(self):
     
    7864        return False
    7965
     66    logger_name = 'waeup.kofa.${sitename}.hostels'
     67    logger_filename = 'hostels.log'
     68
     69    def writeLogMessage(self, view, message):
     70        ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     71        self.logger.info(
     72            '%s - %s - %s' % (ob_class, self.__name__, message))
     73        return
     74
    8075HostelsContainer = attrs_to_fields(HostelsContainer)
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py

    r9701 r13166  
    3737    grok.implements(IHostel)
    3838    grok.provides(IHostel)
    39 
    40     def loggerInfo(self, ob_class, comment=None):
    41         target = self.__name__
    42         return grok.getSite()['hostels'].logger_info(ob_class,target,comment)
    4339
    4440    @property
     
    139135        return removed_counter, added_counter, modified_counter, modified_beds
    140136
     137    def writeLogMessage(self, view, message):
     138        ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     139        self.__parent__.logger.info(
     140            '%s - %s - %s' % (ob_class, self.__name__, message))
     141        return
     142
    141143Hostel = attrs_to_fields(Hostel)
    142144
     
    268270            return old_owner
    269271
    270     def loggerInfo(self, ob_class, comment=None):
    271         target = self.__name__
    272         return grok.getSite()['hostels'].logger_info(ob_class,target,comment)
     272    def writeLogMessage(self, view, message):
     273        ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     274        self.__parent__.__parent__.logger.info(
     275            '%s - %s - %s' % (ob_class, self.__name__, message))
     276        return
    273277
    274278Bed = attrs_to_fields(Bed)
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/interfaces.py

    r13165 r13166  
    7171        """
    7272
    73     def logger_info(ob_class, target, comment=None):
    74         """Get the logger's info method.
     73    def writeLogMessage(view, message):
     74        """Add an INFO message to ``hostels.log``.
    7575        """
    7676
     
    8080
    8181    bed_statistics = Attribute('Number of booked and total beds')
    82 
    83     def loggerInfo(ob_class, comment):
    84         """Adds an INFO message to the log file
    85         """
    8682
    8783    def clearHostel():
     
    211207            raise Invalid(_('Bed categories overlap.'))
    212208
     209    def writeLogMessage(view, message):
     210        """Add an INFO message to ``hostels.log``.
     211        """
     212
    213213class IBed(IKofaObject):
    214214    """A base representation of beds.
     
    216216
    217217    coordinates = Attribute('The coordinates of the bed from bed_id')
    218 
    219     def loggerInfo(ob_class, comment):
    220         """Adds an INFO message to the log file
    221         """
    222218
    223219    def bookBed(student_id):
     
    272268            raise Invalid(_(
    273269                "This student resides in bed ${a}.", mapping = {'a':allocated_bed}))
     270
     271    def writeLogMessage(view, message):
     272        """Add an INFO message to ``hostels.log``.
     273        """
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r13165 r13166  
    154154
    155155    def writeLogMessage(view, message):
    156         """Write a view specific log message into students.log.
     156        """Add an INFO message to ``students.log``.
    157157        """
    158158
Note: See TracChangeset for help on using the changeset viewer.