~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches

  • Committer: Paul Hummer
  • Date: 2009-03-30 22:39:07 UTC
  • mfrom: (314.1.9 memory-profiling)
  • Revision ID: paul@canonical.com-20090330223907-66ndm7vo0dg43if3
Added MemoryProfileMiddleware

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
                            "(defaults to 8080)."))
51
51
    parser.add_option("--host", dest="user_host",
52
52
                      help="Host Loggerhead should listen on.")
 
53
    parser.add_option('--memory-profile', action='store_true',
 
54
                      dest='memory_profile',
 
55
                      help='Profile the memory usage using heapy.')
53
56
    parser.add_option("--prefix", dest="user_prefix",
54
57
                      help="Specify host prefix.")
55
58
    parser.add_option("--profile", action="store_true", dest="profile",
117
120
    logfile.setFormatter(formatter)
118
121
    logfile.setLevel(logging.DEBUG)
119
122
    logger.addHandler(logfile)
 
123
 
 
124
    memprofile = logging.getLogger('loggerhead-memprofile')
 
125
    memprofile.setLevel(logging.DEBUG)
 
126
    memprofile.addHandler(logging.FileHandler('loggerhead-memprofile'))
 
127
 
120
128
    # setup_logging() #end
 
129
 
121
130
    app = TransLogger(app, logger=logger)
122
131
    if options.profile:
123
132
        from loggerhead.middleware.profile import LSProfMiddleware
124
133
        app = LSProfMiddleware(app)
 
134
    if options.memory_profile:
 
135
        from loggerhead.middleware.profile import MemoryProfileMiddleware
 
136
        app = MemoryProfileMiddleware(app)
125
137
 
126
138
    if not options.user_prefix:
127
139
        prefix = '/'