tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
X\¬Qc@s"dZddlZddlZddlZddlZddlZddlZddlZddlZddl    m
Z
m Z m Z yddl Z Wnek
r«dZ nXyeeZWnek
rÓeZnXdZdZdZdZdZdZd$Zd ejfd „ƒYZd efd„ƒYZdefd„ƒYZdejfd„ƒYZ dej!fd„ƒYZ"de"fd„ƒYZ#dej!fd„ƒYZ$dej!fd„ƒYZ%dej!fd„ƒYZ&dej!fd„ƒYZ'dej!fd „ƒYZ(d!e(fd"„ƒYZ)dS(%sû
Additional handlers for the logging package for Python. The core package is
based on PEP 282 and comments thereto in comp.lang.python.
 
Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved.
 
To use, simply 'import logging.handlers' and log away!
iÿÿÿÿN(tST_DEVtST_INOtST_MTIMEi<#i=#i>#i?#iii<tBaseRotatingHandlercBs&eZdZddd„Zd„ZRS(s¹
    Base class for handlers that rotate log files at a certain point.
    Not meant to be instantiated directly.  Instead, use RotatingFileHandler
    or TimedRotatingFileHandler.
    icCsGtdkrd}ntjj|||||ƒ||_||_dS(sA
        Use the specified filename for streamed logging
        N(tcodecstNonetloggingt FileHandlert__init__tmodetencoding(tselftfilenameR    R
tdelay((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR:s
         cCsgy3|j|ƒr|jƒntjj||ƒWn-ttfk
rO‚n|j|ƒnXdS(s„
        Emit a record.
 
        Output the record to the file, catering for rollover as described
        in doRollover().
        N(tshouldRollovert
doRolloverRRtemittKeyboardInterruptt
SystemExitt handleError(R trecord((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRDs N(t__name__t
__module__t__doc__RRR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR4s
tRotatingFileHandlercBs8eZdZdddddd„Zd„Zd„ZRS(s‹
    Handler for logging to a set of files, which switches from one file
    to the next when the current file reaches a certain size.
    taicCsD|dkrd}ntj|||||ƒ||_||_dS(sú
        Open the specified file and use it as the stream for logging.
 
        By default, the file grows indefinitely. You can specify particular
        values of maxBytes and backupCount to allow the file to rollover at
        a predetermined size.
 
        Rollover occurs whenever the current log file is nearly maxBytes in
        length. If backupCount is >= 1, the system will successively create
        new files with the same pathname as the base file, but with extensions
        ".1", ".2" etc. appended to it. For example, with a backupCount of 5
        and a base file name of "app.log", you would get "app.log",
        "app.log.1", "app.log.2", ... through to "app.log.5". The file being
        written to is always "app.log" - when it gets filled up, it is closed
        and renamed to "app.log.1", and if files "app.log.1", "app.log.2" etc.
        exist, then they are renamed to "app.log.2", "app.log.3" etc.
        respectively.
 
        If maxBytes is zero, rollover never occurs.
        iRN(RRtmaxBytest backupCount(R R R    RRR
R ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRYs
         cCs|jr"|jjƒd|_n|jdkr x’t|jdddƒD]w}d|j|f}d|j|df}tjj|ƒrKtjj|ƒr¯tj    |ƒntj
||ƒqKqKW|jd}tjj|ƒrõtj    |ƒntj
|j|ƒn|j ƒ|_dS(s<
        Do a rollover, as described in __init__().
        iiiÿÿÿÿs%s.%ds.1N( tstreamtcloseRRtranget baseFilenametostpathtexiststremovetrenamet_open(R titsfntdfn((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRys         cCsƒ|jdkr!|jƒ|_n|jdkrd|j|ƒ}|jjddƒ|jjƒt|ƒ|jkrdSndS(s£
        Determine if rollover should occur.
 
        Basically, see if the supplied record would cause the file to exceed
        the size limit we have.
        is%s
iiN(RRR%Rtformattseekttelltlen(R Rtmsg((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRs"N(RRRRRRR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRTs     tTimedRotatingFileHandlercBsMeZdZdddd    eed„Zd„Zd„Zd„Zd„Z    RS(
    Handler for logging to a file, rotating the log file at certain timed
    intervals.
 
    If backupCount is > 0, when rollover is done, no more than backupCount
    files are kept - the oldest ones are deleted.
    thiic    Cs2tj||d||ƒ|jƒ|_||_||_|jdkrgd|_d|_d|_nV|jdkr”d|_d|_d    |_n)|jd
krÁd|_d |_d |_nü|jd ksß|jdkrýd|_d|_d|_nÀ|jj    dƒrªd|_t
|jƒdkrCt d|jƒ‚n|jddksi|jddkrt d|jƒ‚nt |jdƒ|_ d|_d|_nt d|jƒ‚tj|jƒ|_|j||_tjj|ƒr
tj|ƒt}nt tjƒƒ}|j|ƒ|_dS( NRtSis%Y-%m-%d_%H-%M-%Ss%^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}$tMi<s%Y-%m-%d_%H-%Ms^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}$tHs %Y-%m-%d_%Hs^\d{4}-\d{2}-\d{2}_\d{2}$tDtMIDNIGHTis%Y-%m-%ds^\d{4}-\d{2}-\d{2}$tWiisHYou must specify a day for weekly rollover from 0 to 6 (0 is Monday): %st0t6s-Invalid day specified for weekly rollover: %ss'Invalid rollover interval specified: %siii€Qii€Qi€:    (RRtuppertwhenRtutctintervaltsuffixtextMatcht
startswithR,t
ValueErrortintt    dayOfWeektretcompileR R!R"tstatRttimetcomputeRollovert
rolloverAt(    R R R9R;RR
R R:tt((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR¨sH                                                 &     cCsq||j}|jdks.|jjdƒrm|jrItj|ƒ}ntj|ƒ}|d}|d}|d}t|d|d|}||}|jjdƒrm|d}||jkrj||jkrä|j|}    nd||jd}    ||    d}
|js^|d
} tj|
ƒd
} | | kr^| sHd } nd } |
| 7}
q^n|
}qjqmn|S(sI
        Work out the rollover time based on the specified time.
        R4R5iiii<iiiiÿÿÿÿiðñÿÿiii€Q(    R;R9R>R:REtgmtimet    localtimet    _MIDNIGHTRA(R t currentTimetresultRHt currentHourt currentMinutet currentSecondtrtdayt
daysToWaitt newRolloverAttdstNowt dstAtRollovertaddend((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRFÝs8 !    
 
 
 
 
    
     cCs)ttjƒƒ}||jkr%dSdS(s±
        Determine if rollover should occur.
 
        record is not used, as we are just comparing times, but it is needed so
        the method signatures are the same
        ii(R@RERG(R RRH((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRsc    Csètjj|jƒ\}}tj|ƒ}g}|d}t|ƒ}x\|D]T}|| |krM||}|jj|ƒr¡|jtjj    ||ƒƒq¡qMqMW|j
ƒt|ƒ|j krÍg}n|t|ƒ|j  }|S(s
        Determine the files to delete when rolling over.
 
        More specific than the earlier method, which just used glob.glob().
        t.( R R!tsplitRtlistdirR,R=tmatchtappendtjointsortR(    R tdirNametbaseNamet    fileNamesRMtprefixtplentfileNameR<((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pytgetFilesToDelete&s
 
&
    c Cs|jr"|jjƒd|_nttjƒƒ}tj|ƒd}|j|j}|jrrtj    |ƒ}nPtj|ƒ}|d}||krÂ|r¦d}nd}tj||ƒ}n|j
dtj |j |ƒ}t jj|ƒrt j|ƒnt j|j
|ƒ|jdkrMx$|jƒD]}t j|ƒq3Wn|jƒ|_|j|ƒ}    x|    |krŠ|    |j}    qnW|jdks¬|jjdƒrú|j rútj|    ƒd}
||
krú|säd}nd}|    |7}    qún|    |_dS(    sx
        do a rollover; in this case, a date/time stamp is appended to the filename
        when the rollover happens.  However, you want the file to be named for the
        start of the interval, not the current time.  If there is a backup count,
        then we have to get a list of matching filenames, sort them and remove
        the one with the oldest suffix.
        iÿÿÿÿiiðñÿÿRXiR4R5N(RRRR@RERJRGR;R:RIRtstrftimeR<R R!R"R#R$RReR%RFR9R>( R RLRURHt    timeTupletdstThenRWR(tsRTRV((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR=sD          
      +     N(
RRRRtFalseRRFRReR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR. s 5    <        tWatchedFileHandlercBs2eZdZdddd„Zd„Zd„ZRS(s‚
    A handler for logging to a file, which watches the file
    to see if it has changed while in use. This can happen because of
    usage of programs such as newsyslog and logrotate which perform
    log file rotation. This handler, intended for use under Unix,
    watches the file to see if it has changed since the last emit.
    (A file has changed if its device or inode have changed.)
    If it has changed, the old file stream is closed, and the file
    opened to get a new stream.
 
    This handler is not appropriate for use under Windows, because
    under Windows open files cannot be moved or renamed - logging
    opens the files with exclusive locks - and so there is no need
    for such a handler. Furthermore, ST_INO is not supported under
    Windows; stat always returns zero for this value.
 
    This handler is based on a suggestion and patch by Chad J.
    Schroeder.
    RicCs<tjj|||||ƒd\|_|_|jƒdS(Niÿÿÿÿ(iÿÿÿÿiÿÿÿÿ(RRRtdevtinot _statstream(R R R    R
R ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR‡scCsC|jr?tj|jjƒƒ}|t|t|_|_ndS(N(RR tfstattfilenoRRRlRm(R tsres((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRnŒs    cCsÖytj|jƒ}Wn1tk
rI}|jtjkrCd}qJ‚nX| sw|t|jksw|t    |j
kr¿|j dk    r¿|j j ƒ|j j ƒ|jƒ|_ |jƒq¿ntjj||ƒdS(s¼
        Emit a record.
 
        First check if the underlying file has changed, and if it
        has, close the old stream and reopen the file to get the
        current stream.
        N(R RDRtOSErrorterrnotENOENTRRRlRRmRtflushRR%RnRRR(R RRqterr((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR‘s     -  N(RRRRRRnR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRkss    t SocketHandlercBsYeZdZd„Zdd„Zd„Zd„Zd„Zd„Zd„Z    d    „Z
RS(
s
    A handler class which writes logging records, in pickle format, to
    a streaming socket. The socket is kept open across logging calls.
    If the peer resets it, an attempt is made to reconnect on the next call.
    The pickle which is sent is that of the LogRecord's attribute dictionary
    (__dict__), so that the receiver does not need to have the logging module
    installed in order to process the logging event.
 
    To unpickle the record at the receiving end into a LogRecord, use the
    makeLogRecord function.
    cCs\tjj|ƒ||_||_d|_d|_d|_d|_    d|_
d|_ dS(s    
        Initializes the handler with a specific host address and port.
 
        The attribute 'closeOnError' is set to 1 - which means that if
        a socket error occurs, the socket is silently closed and then
        reopened on the next logging call.
        igð?g>@g@N( RtHandlerRthosttportRtsockt closeOnErrort    retryTimet
retryStarttretryMaxt retryFactor(R RyRz((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR½s                            icCsTtjtjtjƒ}t|dƒr7|j|ƒn|j|j|jfƒ|S(sr
        A factory method which allows subclasses to define the precise
        type of socket they want.
        t
settimeout(tsockettAF_INETt SOCK_STREAMthasattrRtconnectRyRz(R ttimeoutRi((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt
makeSocketÒs
cCsÕtjƒ}|jdkr$d}n||jk}|rÑy|jƒ|_d|_WqÑtjk
rÍ|jdkr†|j|_n4|j|j    |_|j|j
krº|j
|_n||j|_qÑXndS(sÌ
        Try to create a socket, using an exponential backoff with
        a max retry time. Thanks to Robert Olson for the original patch
        (SF #815911) which has been slightly refactored.
        iN( RER}RRˆR{R‚terrorR~t retryPeriodR€R(R tnowtattempt((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt createSocketÝs      cCsÑ|jdkr|jƒn|jrÍyxt|jdƒrM|jj|ƒnOd}t|ƒ}x:|dkr›|jj||ƒ}||}||}qbWWqÍtjk
rÉ|jj    ƒd|_qÍXndS(s™
        Send a pickled string to the socket.
 
        This function allows for partial sends which can happen when the
        network is busy.
        tsendalliN(
R{RRR…RŽR,tsendR‚R‰R(R Rit    sentsofartlefttsent((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRùs      
 cCs—|j}|r*|j|ƒ}d|_nt|jƒ}|jƒ|d<d|d<tj|dƒ}|rw||_ntj    dt
|ƒƒ}||S(sŒ
        Pickles the record in binary format with a length prefix, and
        returns it ready for transmission across the socket.
        R-targsis>LN( texc_infoR)Rtdictt__dict__t
getMessagetcPickletdumpststructtpackR,(R RteitdummytdRitslen((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt
makePickles     
 cCsB|jr+|jr+|jjƒd|_ntjj||ƒdS(sÎ
        Handle an error during logging.
 
        An error has occurred during logging. Most likely cause -
        connection lost. Close the socket so that we can retry on the
        next event.
        N(R|R{RRRRxR(R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR*s  cCsTy |j|ƒ}|j|ƒWn-ttfk
r<‚n|j|ƒnXdS(s
        Emit a record.
 
        Pickles the record and writes it to the socket in binary format.
        If there is an error with the socket, silently drop the packet.
        If there was a problem with the socket, re-establishes the
        socket.
        N(R RRRR(R RRi((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR8s    cCsR|jƒz&|jr/|jjƒd|_nWd|jƒXtjj|ƒdS(s$
        Closes the socket.
        N(tacquireR{RRtreleaseRRx(R ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRIs
      ( RRRRRˆRRR RRR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRw°s                         tDatagramHandlercBs)eZdZd„Zd„Zd„ZRS(s˜
    A handler class which writes logging records, in pickle format, to
    a datagram socket.  The pickle which is sent is that of the LogRecord's
    attribute dictionary (__dict__), so that the receiver does not need to
    have the logging module installed in order to process the logging event.
 
    To unpickle the record at the receiving end into a LogRecord, use the
    makeLogRecord function.
 
    cCs tj|||ƒd|_dS(sP
        Initializes the handler with a specific host address and port.
        iN(RwRR|(R RyRz((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRascCstjtjtjƒ}|S(su
        The factory method of SocketHandler is here overridden to create
        a UDP socket (SOCK_DGRAM).
        (R‚Rƒt
SOCK_DGRAM(R Ri((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRˆhscCs?|jdkr|jƒn|jj||j|jfƒdS(só
        Send a pickled string to a socket.
 
        This function no longer allows for partial sends which can happen
        when the network is busy - UDP does not guarantee delivery and
        can deliver packets out of sequence.
        N(R{RRtsendtoRyRz(R Ri((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRps (RRRRRˆR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR£Vs
        t SysLogHandlercBseZdZdZdZdZdZdZdZdZ    dZ
dZ dZ dZ dZdZdZdZdZd    Zd
Zd Zd Zd ZdZdZdZdZdZdZdZi ed6ed6ed6e
d6ed6ed6ed6e    d6ed6ed6ed6ed 6Zied!6ed"6ed#6ed$6ed%6e d&6ed'6e d(6ed)6ed*6ed+6e d,6ed-6ed.6ed/6ed06ed16ed26ed36ed46ed56Z idd66dd76d d86dd96dd:6Z!d;e"fe dCd<„Z$d=„Z%d>Z&d?„Z'd@„Z(dA„Z)dB„Z*RS(Ds
    A handler class which sends formatted logging records to a syslog
    server. Based on Sam Rushing's syslog module:
    http://www.nightmare.com/squirl/python-ext/misc/syslog.py
    Contributed by Nicolas Untz (after which minor refactoring changes
    have been made).
    iiiiiiiiii    i
i iiiiiiiitalerttcrittcriticaltdebugtemergRvR‰tinfotnoticetpanictwarntwarningtauthtauthprivtcrontdaemontftptkerntlprtmailtnewstsecuritytsyslogtusertuucptlocal0tlocal1tlocal2tlocal3tlocal4tlocal5tlocal6tlocal7tDEBUGtINFOtWARNINGtERRORtCRITICALt    localhostcCsÄtjj|ƒ||_||_||_t|tƒrSd|_|j    |ƒndd|_|dkrtt j }nt j t j |ƒ|_ |t jkr®|j j|ƒn||_d|_dS(s
        Initialize a handler.
 
        If address is specified as a string, a UNIX socket is used. To log to a
        local syslogd, "SysLogHandler(address="/dev/log")" can be used.
        If facility is not specified, LOG_USER is used. If socktype is
        specified as socket.SOCK_DGRAM or socket.SOCK_STREAM, that specific
        socket type will be used. For Unix sockets, you can also specify a
        socktype of None, in which case socket.SOCK_DGRAM will be used, falling
        back to socket.SOCK_STREAM.
        iiN(RRxRtaddresstfacilitytsocktypet
isinstancet
basestringt
unixsockett_connect_unixsocketRR‚R¤RƒR„R†t    formatter(R RÌRÍRÎ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRãs                           cCsø|j}|dkr!tj}ntjtj|ƒ|_y|jj|ƒ||_Wn›tjk
ró|jjƒ|jdk    r‹‚ntj}tjtj|ƒ|_y|jj|ƒ||_Wqôtjk
rï|jjƒ‚qôXnXdS(N(    RÎRR‚R¤tAF_UNIXR†R‰RR„(R RÌt use_socktype((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRÒs&              s<%d>%scCsJt|tƒr|j|}nt|tƒr>|j|}n|d>|BS(sé
        Encode the facility and priority. You can pass in strings or
        integers - if strings are passed, the facility_names and
        priority_names mapping dictionaries are used to convert them to
        integers.
        i(RÏRÐtfacility_namestpriority_names(R RÍtpriority((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pytencodePriority!s
cCsI|jƒz|jr&|jjƒnWd|jƒXtjj|ƒdS(s$
        Closes the socket.
        N(R¡RÑR‚RR¢RRx(R ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR.s 
     cCs|jj|dƒS(sK
        Map a logging level name to a key in the priority_names map.
        This is useful in two scenarios: when custom levels are being
        used, and in the case where you can't do a straightforward
        mapping by lowercasing the logging level name because of locale-
        specific issues (see SF #1524081).
        R°(t priority_maptget(R t    levelName((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt mapPriority:scCs0|j|ƒd}d|j|j|j|jƒƒ}t|ƒtkr\|jdƒ}n||}y–|jrÀy|j    j
|ƒWqût    j k
r¼|j |j ƒ|j    j
|ƒqûXn;|jt    jkrë|j    j||j ƒn|j    j|ƒWn-ttfk
r‚n|j|ƒnXdS(s±
        Emit a record.
 
        The record is formatted, and then sent to the syslog server. If
        exception information is present, it is NOT sent to the server.
        ts<%d>sutf-8N(R)RÙRÍRÝt    levelnamettypetunicodetencodeRÑR‚RR‰RÒRÌRÎR¤R¥RŽRRR(R RR-tprio((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRDs(
    N(+RRRt    LOG_EMERGt    LOG_ALERTtLOG_CRITtLOG_ERRt LOG_WARNINGt
LOG_NOTICEtLOG_INFOt    LOG_DEBUGtLOG_KERNtLOG_USERtLOG_MAILt
LOG_DAEMONtLOG_AUTHt
LOG_SYSLOGtLOG_LPRtLOG_NEWStLOG_UUCPtLOG_CRONt LOG_AUTHPRIVtLOG_FTPt
LOG_LOCAL0t
LOG_LOCAL1t
LOG_LOCAL2t
LOG_LOCAL3t
LOG_LOCAL4t
LOG_LOCAL5t
LOG_LOCAL6t
LOG_LOCAL7R×RÖRÚtSYSLOG_UDP_PORTRRRÒtlog_format_stringRÙRRÝR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR¦|sœ 
 
 
                    
t SMTPHandlercBs/eZdZddd„Zd„Zd„ZRS(sK
    A handler class which sends an SMTP email for each logging event.
    cCsÀtjj|ƒt|tƒr4|\|_|_n|d|_|_t|tƒrk|\|_|_    n    d|_||_
t|t ƒr˜|g}n||_ ||_ ||_d|_dS(s 
        Initialize the handler.
 
        Initialize the instance with the from and to addresses and subject
        line of the email. To specify a non-standard SMTP port, use the
        (host, port) tuple format for the mailhost argument. To specify
        authentication credentials, supply a (username, password) tuple
        for the credentials argument. To specify the use of a secure
        protocol (TLS), pass in a tuple for the secure argument. This will
        only be used when authentication credentials are supplied. The tuple
        will be either an empty tuple, or a single-value tuple with the name
        of a keyfile, or a 2-value tuple with the names of the keyfile and
        certificate file. (This tuple is passed to the `starttls` method).
        g@N(RRxRRÏttupletmailhosttmailportRtusernametpasswordtfromaddrRÐttoaddrstsubjecttsecuret_timeout(R RRR    R
t credentialsR ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRjs                     cCs|jS(sž
        Determine the subject for the email.
 
        If you want to specify a subject line which is record-dependent,
        override this method.
        (R
(R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt
getSubject‹scCsKyddl}ddlm}|j}|s:|j}n|j|j|d|jƒ}|j|ƒ}d|j    dj
|j ƒ|j |ƒ|ƒ|f}|j ró|jdk    rÚ|jƒ|j|jŒ|jƒn|j|j |jƒn|j|j    |j |ƒ|jƒWn-ttfk
r3‚n|j|ƒnXdS(sd
        Emit a record.
 
        Format the record and send it to the specified addressees.
        iÿÿÿÿN(t
formatdateR‡s-From: %s
To: %s
Subject: %s
Date: %s
 
%st,(tsmtplibt email.utilsRRt    SMTP_PORTtSMTPRR R)RR]R    RRR RtehlotstarttlstloginRtsendmailtquitRRR(R RRRRztsmtpR-((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR”s2           
 N(RRRRRRR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRfs         tNTEventLogHandlercBsJeZdZddd„Zd„Zd„Zd„Zd„Zd„Z    RS(    sý
    A handler class which sends events to the NT Event Log. Adds a
    registry entry for the specified application name. If no dllname is
    provided, win32service.pyd (which contains some basic message
    placeholders) is used. Note that use of these placeholders will make
    your event logs big, as the entire message source is held in the log.
    If you want slimmer logs, you have to pass in the name of your own DLL
    which contains the message definitions you want to use in the event log.
    t ApplicationcCs2tjj|ƒyüddl}ddl}||_||_|stjj    |jj
ƒ}tjj    |dƒ}tjj |ddƒ}n||_ ||_ |jj|||ƒ|j|_i|jtj6|jtj6|jtj6|jtj6|jtj6|_Wntk
r-dGHd|_nXdS(Niÿÿÿÿiswin32service.pydsWThe Python Win32 extensions for NT (service, event logging) appear not to be available.(RRxRtwin32evtlogutilt win32evtlogtappnamet_weluR R!RYt__file__R]tdllnametlogtypetAddSourceToRegistrytEVENTLOG_ERROR_TYPEtdeftypetEVENTLOG_INFORMATION_TYPERÆRÇtEVENTLOG_WARNING_TYPERÈRÉRÊttypemapt ImportErrorR(R RR"R#RR((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR¾s,                      cCsdS(sy
        Return the message ID for the event record. If you are using your
        own messages, you could do this by having the msg passed to the
        logger being an ID rather than a formatting string. Then, in here,
        you could use a dictionary lookup to get the message ID. This
        version returns 1, which is the base message ID in win32service.pyd.
        i((R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt getMessageIDØscCsdS(sž
        Return the event category for the record.
 
        Override this if you want to specify your own categories. This version
        returns 0.
        i((R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pytgetEventCategoryâscCs|jj|j|jƒS(så
        Return the event type for the record.
 
        Override this if you want to specify your own types. This version does
        a mapping using the handler's typemap attribute, which is set up in
        __init__() to a dictionary which contains mappings for DEBUG, INFO,
        WARNING, ERROR and CRITICAL. If you are using your own levels you will
        either need to override this method or place a suitable dictionary in
        the handler's typemap attribute.
        (R)RÛtlevelnoR&(R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt getEventTypeës cCs¢|jržyb|j|ƒ}|j|ƒ}|j|ƒ}|j|ƒ}|jj|j||||gƒWqžttfk
r‡‚qž|j    |ƒqžXndS(s”
        Emit a record.
 
        Determine the message ID, event category and event type. Then
        log the message in the NT event log.
        N(
R R+R,R.R)t ReportEventRRRR(R RtidtcatRàR-((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRøs    &cCstjj|ƒdS(sS
        Clean up this handler.
 
        You can remove the application name from the registry as a
        source of event log entries. However, if you do this, you will
        not be able to see the events as you intended in the Event Log
        Viewer - it needs to be able to access the registry to get the
        DLL name.
        N(RRxR(R ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR s N(
RRRRRR+R,R.RR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR´s        
               t HTTPHandlercBs,eZdZdd„Zd„Zd„ZRS(s^
    A class which sends records to a Web server, using either GET or
    POST semantics.
    tGETcCsVtjj|ƒ|jƒ}|dkr7tdƒ‚n||_||_||_dS(sr
        Initialize the instance with the host, the request URL, and the method
        ("GET" or "POST")
        R3tPOSTsmethod must be GET or POSTN(R3R4(RRxRR8R?Ryturltmethod(R RyR5R6((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRs          cCs|jS(s´
        Default implementation of mapping the log record into a dict
        that is sent as the CGI data. Overwrite in your class.
        Contributed by Franz  Glasner.
        (R–(R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt mapLogRecord*sc
CsˆyTddl}ddl}|j}|j|ƒ}|j}|j|j|ƒƒ}|jdkrž|jdƒdkrd}nd}|d||f}n|j    |j|ƒ|jdƒ}    |    dkrÙ||     }n|j
d    |ƒ|jd
kr'|j
d d ƒ|j
d t t |ƒƒƒn|j |jd
krB|ndƒ|jƒWn-ttfk
rp‚n|j|ƒnXdS(sk
        Emit a record.
 
        Send the record to the Web server as a percent-encoded dictionary
        iÿÿÿÿNR3t?it&s%c%st:tHostR4s Content-types!application/x-www-form-urlencodedsContent-length(thttplibturllibRytHTTPR5t    urlencodeR7R6tfindt
putrequestt    putheadertstrR,t
endheadersRtgetreplyRRR(
R RR<R=RyR/R5tdatatsepR&((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR2s4                  "(RRRRR7R(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR2s    tBufferingHandlercBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(så
  A handler class which buffers logging records in memory. Whenever each
  record is added to the buffer, a check is made to see if the buffer should
  be flushed. If it should, then flush() is expected to do what's needed.
    cCs&tjj|ƒ||_g|_dS(s>
        Initialize the handler with the buffer size.
        N(RRxRtcapacitytbuffer(R RI((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR\s    cCst|jƒ|jkS(s¼
        Should the handler flush its buffer?
 
        Returns true if the buffer is up to capacity. This method can be
        overridden to implement custom flushing strategies.
        (R,RJRI(R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt shouldFlushdscCs0|jj|ƒ|j|ƒr,|jƒndS(s†
        Emit a record.
 
        Append the record. If shouldFlush() tells us to, call flush() to process
        the buffer.
        N(RJR\RKRu(R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRmscCs)|jƒz g|_Wd|jƒXdS(sw
        Override to implement custom flushing behaviour.
 
        This version just zaps the buffer to empty.
        N(R¡RJR¢(R ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRuxs
 cCs|jƒtjj|ƒdS(sp
        Close the handler.
 
        This version just flushes and chains to the parent class' close().
        N(RuRRxR(R ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR„s
(RRRRRKRRuR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRHVs                      t MemoryHandlercBsDeZdZejdd„Zd„Zd„Zd„Z    d„Z
RS(sâ
    A handler class which buffers logging records in memory, periodically
    flushing them to a target handler. Flushing occurs whenever the buffer
    is full, or when an event of a certain severity or greater is seen.
    cCs&tj||ƒ||_||_dS(s
        Initialize the handler with the buffer size, the level at which
        flushing should occur and an optional target.
 
        Note that without a target being set either here or via setTarget(),
        a MemoryHandler is no use to anyone!
        N(RHRt
flushLevelttarget(R RIRMRN((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR“s    cCs(t|jƒ|jkp'|j|jkS(sP
        Check for buffer full or a record at the flushLevel or higher.
        (R,RJRIR-RM(R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRKŸscCs ||_dS(s:
        Set the target handler for this handler.
        N(RN(R RN((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt    setTarget¦scCsY|jƒz=|jrFx!|jD]}|jj|ƒq Wg|_nWd|jƒXdS(s±
        For a MemoryHandler, flushing means just sending the buffered
        records to the target, if there is one. Override if you want
        different behaviour.
        N(R¡RNRJthandleR¢(R R((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRu¬s
    cCs@|jƒ|jƒzd|_tj|ƒWd|jƒXdS(sD
        Flush, set the target to None and lose the buffer.
        N(RuR¡RRNRHRR¢(R ((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyR»s 
 
    N( RRRRRÉRRRKRORuR(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyRLs             i i€Q(*RRsRR‚R R˜RšRERBRDRRRRR*RRátTruet_unicodet    NameErrorRjtDEFAULT_TCP_LOGGING_PORTtDEFAULT_UDP_LOGGING_PORTtDEFAULT_HTTP_LOGGING_PORTtDEFAULT_SOAP_LOGGING_PORTRtSYSLOG_TCP_PORTRKRRRR.RkRxRwR£R¦RRR2RHRL(((sX/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/logging/handlers.pyt<module>s<` 
 
 
 LÓ=¦&êNd>7