ominfra 0.0.0.dev424__py3-none-any.whl → 0.0.0.dev426__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ominfra/clouds/aws/journald2aws/cursor.py +4 -1
- ominfra/clouds/aws/journald2aws/driver.py +4 -1
- ominfra/clouds/aws/journald2aws/poster.py +4 -1
- ominfra/clouds/aws/models/services/ec2.py +31 -0
- ominfra/journald/messages.py +4 -1
- ominfra/journald/tailer.py +4 -1
- ominfra/manage/deploy/commands.py +4 -1
- ominfra/manage/main.py +4 -1
- ominfra/manage/remote/_main.py +4 -1
- ominfra/manage/remote/execution.py +4 -1
- ominfra/manage/system/commands.py +4 -1
- ominfra/manage/system/platforms.py +4 -1
- ominfra/scripts/journald2aws.py +379 -32
- ominfra/scripts/manage.py +384 -32
- ominfra/scripts/supervisor.py +385 -36
- ominfra/supervisor/dispatchersimpl.py +4 -1
- ominfra/supervisor/io.py +4 -1
- ominfra/supervisor/main.py +2 -2
- ominfra/supervisor/processimpl.py +4 -1
- ominfra/supervisor/setupimpl.py +4 -1
- ominfra/supervisor/signals.py +4 -1
- ominfra/supervisor/supervisor.py +4 -1
- ominfra/threadworkers.py +4 -1
- {ominfra-0.0.0.dev424.dist-info → ominfra-0.0.0.dev426.dist-info}/METADATA +3 -3
- {ominfra-0.0.0.dev424.dist-info → ominfra-0.0.0.dev426.dist-info}/RECORD +30 -30
- /ominfra/{.manifests.json → .omlish-manifests.json} +0 -0
- {ominfra-0.0.0.dev424.dist-info → ominfra-0.0.0.dev426.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev424.dist-info → ominfra-0.0.0.dev426.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev424.dist-info → ominfra-0.0.0.dev426.dist-info}/licenses/LICENSE +0 -0
- {ominfra-0.0.0.dev424.dist-info → ominfra-0.0.0.dev426.dist-info}/top_level.txt +0 -0
ominfra/scripts/journald2aws.py
CHANGED
@@ -67,8 +67,10 @@ TomlParseFloat = ta.Callable[[str], ta.Any] # ta.TypeAlias
|
|
67
67
|
TomlKey = ta.Tuple[str, ...] # ta.TypeAlias
|
68
68
|
TomlPos = int # ta.TypeAlias
|
69
69
|
|
70
|
-
# ../../../../omlish/lite/
|
70
|
+
# ../../../../omlish/lite/attrops.py
|
71
71
|
T = ta.TypeVar('T')
|
72
|
+
|
73
|
+
# ../../../../omlish/lite/cached.py
|
72
74
|
CallableT = ta.TypeVar('CallableT', bound=ta.Callable)
|
73
75
|
|
74
76
|
# ../../../../omlish/lite/check.py
|
@@ -1304,6 +1306,335 @@ class Abstract:
|
|
1304
1306
|
update_abstracts(cls, force=True)
|
1305
1307
|
|
1306
1308
|
|
1309
|
+
########################################
|
1310
|
+
# ../../../../../omlish/lite/attrops.py
|
1311
|
+
"""
|
1312
|
+
TODO:
|
1313
|
+
- dotted paths!
|
1314
|
+
- per-attr repr transform / filter
|
1315
|
+
- __ne__ ? cases where it still matters
|
1316
|
+
- ordering ?
|
1317
|
+
"""
|
1318
|
+
|
1319
|
+
|
1320
|
+
##
|
1321
|
+
|
1322
|
+
|
1323
|
+
@ta.final
|
1324
|
+
class AttrOps(ta.Generic[T]):
|
1325
|
+
@ta.final
|
1326
|
+
class Attr:
|
1327
|
+
def __init__(
|
1328
|
+
self,
|
1329
|
+
name: str,
|
1330
|
+
*,
|
1331
|
+
display: ta.Optional[str] = None,
|
1332
|
+
|
1333
|
+
repr: bool = True, # noqa
|
1334
|
+
hash: bool = True, # noqa
|
1335
|
+
eq: bool = True,
|
1336
|
+
) -> None:
|
1337
|
+
if '.' in name:
|
1338
|
+
raise NotImplementedError('Dotted paths not yet supported')
|
1339
|
+
if not name.isidentifier() or name.startswith('__'):
|
1340
|
+
raise AttributeError(f'Invalid attr: {name!r}')
|
1341
|
+
self._name = name
|
1342
|
+
|
1343
|
+
if display is None:
|
1344
|
+
display = name[1:] if name.startswith('_') and len(name) > 1 else name
|
1345
|
+
self._display = display
|
1346
|
+
|
1347
|
+
self._repr = repr
|
1348
|
+
self._hash = hash
|
1349
|
+
self._eq = eq
|
1350
|
+
|
1351
|
+
@classmethod
|
1352
|
+
def of(
|
1353
|
+
cls,
|
1354
|
+
o: ta.Union[
|
1355
|
+
str,
|
1356
|
+
ta.Tuple[str, str],
|
1357
|
+
'AttrOps.Attr',
|
1358
|
+
],
|
1359
|
+
) -> 'AttrOps.Attr':
|
1360
|
+
if isinstance(o, AttrOps.Attr):
|
1361
|
+
return o
|
1362
|
+
elif isinstance(o, str):
|
1363
|
+
return cls(o)
|
1364
|
+
else:
|
1365
|
+
name, disp = o
|
1366
|
+
return cls(
|
1367
|
+
name,
|
1368
|
+
display=disp,
|
1369
|
+
)
|
1370
|
+
|
1371
|
+
@property
|
1372
|
+
def name(self) -> str:
|
1373
|
+
return self._name
|
1374
|
+
|
1375
|
+
@property
|
1376
|
+
def display(self) -> str:
|
1377
|
+
return self._display
|
1378
|
+
|
1379
|
+
@property
|
1380
|
+
def hash(self) -> bool:
|
1381
|
+
return self._hash
|
1382
|
+
|
1383
|
+
@property
|
1384
|
+
def eq(self) -> bool:
|
1385
|
+
return self._eq
|
1386
|
+
|
1387
|
+
@ta.overload
|
1388
|
+
def __init__(
|
1389
|
+
self,
|
1390
|
+
*attrs: ta.Sequence[ta.Union[
|
1391
|
+
str,
|
1392
|
+
ta.Tuple[str, str],
|
1393
|
+
Attr,
|
1394
|
+
]],
|
1395
|
+
with_module: bool = False,
|
1396
|
+
use_qualname: bool = False,
|
1397
|
+
with_id: bool = False,
|
1398
|
+
repr_filter: ta.Optional[ta.Callable[[ta.Any], bool]] = None,
|
1399
|
+
recursive: bool = False,
|
1400
|
+
subtypes_eq: bool = False,
|
1401
|
+
) -> None:
|
1402
|
+
...
|
1403
|
+
|
1404
|
+
@ta.overload
|
1405
|
+
def __init__(
|
1406
|
+
self,
|
1407
|
+
attrs_fn: ta.Callable[[T], ta.Tuple[ta.Union[
|
1408
|
+
ta.Any,
|
1409
|
+
ta.Tuple[str, ta.Any],
|
1410
|
+
Attr,
|
1411
|
+
], ...]],
|
1412
|
+
/,
|
1413
|
+
*,
|
1414
|
+
with_module: bool = False,
|
1415
|
+
use_qualname: bool = False,
|
1416
|
+
with_id: bool = False,
|
1417
|
+
repr_filter: ta.Optional[ta.Callable[[ta.Any], bool]] = None,
|
1418
|
+
recursive: bool = False,
|
1419
|
+
subtypes_eq: bool = False,
|
1420
|
+
) -> None:
|
1421
|
+
...
|
1422
|
+
|
1423
|
+
def __init__(
|
1424
|
+
self,
|
1425
|
+
*args,
|
1426
|
+
with_module=False,
|
1427
|
+
use_qualname=False,
|
1428
|
+
with_id=False,
|
1429
|
+
repr_filter=None,
|
1430
|
+
recursive=False,
|
1431
|
+
subtypes_eq=False,
|
1432
|
+
) -> None:
|
1433
|
+
if args and len(args) == 1 and callable(args[0]):
|
1434
|
+
self._attrs: ta.Sequence[AttrOps.Attr] = self._capture_attrs(args[0])
|
1435
|
+
else:
|
1436
|
+
self._attrs = list(map(AttrOps.Attr.of, args))
|
1437
|
+
|
1438
|
+
self._with_module: bool = with_module
|
1439
|
+
self._use_qualname: bool = use_qualname
|
1440
|
+
self._with_id: bool = with_id
|
1441
|
+
self._repr_filter: ta.Optional[ta.Callable[[ta.Any], bool]] = repr_filter
|
1442
|
+
self._recursive: bool = recursive
|
1443
|
+
self._subtypes_eq: bool = subtypes_eq
|
1444
|
+
|
1445
|
+
@property
|
1446
|
+
def attrs(self) -> ta.Sequence[Attr]:
|
1447
|
+
return self._attrs
|
1448
|
+
|
1449
|
+
#
|
1450
|
+
|
1451
|
+
@ta.final
|
1452
|
+
class _AttrCapturer:
|
1453
|
+
def __init__(self, fn):
|
1454
|
+
self.__fn = fn
|
1455
|
+
|
1456
|
+
def __getattr__(self, attr):
|
1457
|
+
return self.__fn(self, attr)
|
1458
|
+
|
1459
|
+
@classmethod
|
1460
|
+
def _capture_attrs(cls, fn: ta.Callable) -> ta.Sequence[Attr]:
|
1461
|
+
def access(parent, attr):
|
1462
|
+
dct[(ret := cls._AttrCapturer(access))] = (parent, attr)
|
1463
|
+
return ret
|
1464
|
+
|
1465
|
+
dct: dict = {}
|
1466
|
+
raw = fn(root := cls._AttrCapturer(access))
|
1467
|
+
|
1468
|
+
def rec(cap): # noqa
|
1469
|
+
if cap is root:
|
1470
|
+
return
|
1471
|
+
parent, attr = dct[cap]
|
1472
|
+
yield from rec(parent)
|
1473
|
+
yield attr
|
1474
|
+
|
1475
|
+
attrs: ta.List[AttrOps.Attr] = []
|
1476
|
+
for o in raw:
|
1477
|
+
if isinstance(o, AttrOps.Attr):
|
1478
|
+
attrs.append(o)
|
1479
|
+
continue
|
1480
|
+
|
1481
|
+
if isinstance(o, tuple):
|
1482
|
+
disp, cap, = o
|
1483
|
+
else:
|
1484
|
+
disp, cap = None, o
|
1485
|
+
|
1486
|
+
path = tuple(rec(cap))
|
1487
|
+
|
1488
|
+
attrs.append(AttrOps.Attr(
|
1489
|
+
'.'.join(path),
|
1490
|
+
display=disp,
|
1491
|
+
))
|
1492
|
+
|
1493
|
+
return attrs
|
1494
|
+
|
1495
|
+
#
|
1496
|
+
|
1497
|
+
_repr: ta.Callable[[T], str]
|
1498
|
+
|
1499
|
+
@property
|
1500
|
+
def repr(self) -> ta.Callable[[T], str]:
|
1501
|
+
try:
|
1502
|
+
return self._repr
|
1503
|
+
except AttributeError:
|
1504
|
+
pass
|
1505
|
+
|
1506
|
+
def _repr(o: T) -> str:
|
1507
|
+
vs = ', '.join(
|
1508
|
+
f'{a._display}={v!r}' # noqa
|
1509
|
+
for a in self._attrs
|
1510
|
+
if a._repr # noqa
|
1511
|
+
for v in [getattr(o, a._name)] # noqa
|
1512
|
+
if self._repr_filter is None or self._repr_filter(v)
|
1513
|
+
)
|
1514
|
+
|
1515
|
+
return (
|
1516
|
+
f'{o.__class__.__module__ + "." if self._with_module else ""}'
|
1517
|
+
f'{o.__class__.__qualname__ if self._use_qualname else o.__class__.__name__}'
|
1518
|
+
f'{("@" + hex(id(o))[2:]) if self._with_id else ""}'
|
1519
|
+
f'({vs})'
|
1520
|
+
)
|
1521
|
+
|
1522
|
+
if self._recursive:
|
1523
|
+
_repr = self._reprlib().recursive_repr()(_repr)
|
1524
|
+
|
1525
|
+
self._repr = _repr
|
1526
|
+
return _repr
|
1527
|
+
|
1528
|
+
_reprlib_: ta.ClassVar[ta.Any]
|
1529
|
+
|
1530
|
+
@classmethod
|
1531
|
+
def _reprlib(cls) -> ta.Any:
|
1532
|
+
try:
|
1533
|
+
return cls._reprlib_
|
1534
|
+
except AttributeError:
|
1535
|
+
pass
|
1536
|
+
|
1537
|
+
import reprlib # noqa
|
1538
|
+
|
1539
|
+
cls._reprlib_ = reprlib
|
1540
|
+
return reprlib
|
1541
|
+
|
1542
|
+
#
|
1543
|
+
|
1544
|
+
_hash: ta.Callable[[T], int]
|
1545
|
+
|
1546
|
+
@property
|
1547
|
+
def hash(self) -> ta.Callable[[T], int]:
|
1548
|
+
try:
|
1549
|
+
return self._hash
|
1550
|
+
except AttributeError:
|
1551
|
+
pass
|
1552
|
+
|
1553
|
+
def _hash(o: T) -> int:
|
1554
|
+
return hash(tuple(
|
1555
|
+
getattr(o, a._name) # noqa
|
1556
|
+
for a in self._attrs
|
1557
|
+
if a._hash # noqa
|
1558
|
+
))
|
1559
|
+
|
1560
|
+
self._hash = _hash
|
1561
|
+
return _hash
|
1562
|
+
|
1563
|
+
#
|
1564
|
+
|
1565
|
+
_eq: ta.Callable[[T, ta.Any], ta.Union[bool, 'types.NotImplementedType']]
|
1566
|
+
|
1567
|
+
@property
|
1568
|
+
def eq(self) -> ta.Callable[[T, ta.Any], ta.Union[bool, 'types.NotImplementedType']]:
|
1569
|
+
try:
|
1570
|
+
return self._eq
|
1571
|
+
except AttributeError:
|
1572
|
+
pass
|
1573
|
+
|
1574
|
+
def _eq(o: T, x: ta.Any) -> 'ta.Union[bool, types.NotImplementedType]':
|
1575
|
+
if self._subtypes_eq:
|
1576
|
+
if not isinstance(x, type(o)):
|
1577
|
+
return NotImplemented
|
1578
|
+
else:
|
1579
|
+
if type(x) is not type(o):
|
1580
|
+
return NotImplemented
|
1581
|
+
|
1582
|
+
return all(
|
1583
|
+
getattr(o, a._name) == getattr(x, a._name) # noqa
|
1584
|
+
for a in self._attrs
|
1585
|
+
if a._eq # noqa
|
1586
|
+
)
|
1587
|
+
|
1588
|
+
self._eq = _eq
|
1589
|
+
return _eq
|
1590
|
+
|
1591
|
+
#
|
1592
|
+
|
1593
|
+
@property
|
1594
|
+
def hash_eq(self) -> ta.Tuple[
|
1595
|
+
ta.Callable[[T], int],
|
1596
|
+
ta.Callable[[T, ta.Any], ta.Union[bool, 'types.NotImplementedType']],
|
1597
|
+
]:
|
1598
|
+
return (self.hash, self.eq)
|
1599
|
+
|
1600
|
+
@property
|
1601
|
+
def repr_hash_eq(self) -> ta.Tuple[
|
1602
|
+
ta.Callable[[T], str],
|
1603
|
+
ta.Callable[[T], int],
|
1604
|
+
ta.Callable[[T, ta.Any], ta.Union[bool, 'types.NotImplementedType']],
|
1605
|
+
]:
|
1606
|
+
return (self.repr, self.hash, self.eq)
|
1607
|
+
|
1608
|
+
#
|
1609
|
+
|
1610
|
+
def install(
|
1611
|
+
self,
|
1612
|
+
locals_dct: ta.MutableMapping[str, ta.Any],
|
1613
|
+
*,
|
1614
|
+
all: bool = False, # noqa
|
1615
|
+
repr: bool = False, # noqa
|
1616
|
+
hash: bool = False, # noqa
|
1617
|
+
eq: bool = False,
|
1618
|
+
) -> 'AttrOps[T]':
|
1619
|
+
if repr or all:
|
1620
|
+
locals_dct.update(__repr__=self.repr)
|
1621
|
+
if hash or all:
|
1622
|
+
locals_dct.update(__hash__=self.hash)
|
1623
|
+
if eq or all:
|
1624
|
+
locals_dct.update(__eq__=self.eq)
|
1625
|
+
return self
|
1626
|
+
|
1627
|
+
|
1628
|
+
attr_ops = AttrOps[ta.Any]
|
1629
|
+
|
1630
|
+
|
1631
|
+
##
|
1632
|
+
|
1633
|
+
|
1634
|
+
def attr_repr(obj: ta.Any, *attrs: str, **kwargs: ta.Any) -> str:
|
1635
|
+
return AttrOps(*attrs, **kwargs).repr(obj)
|
1636
|
+
|
1637
|
+
|
1307
1638
|
########################################
|
1308
1639
|
# ../../../../../omlish/lite/cached.py
|
1309
1640
|
|
@@ -1322,7 +1653,7 @@ class _AbstractCachedNullary:
|
|
1322
1653
|
def __call__(self, *args, **kwargs): # noqa
|
1323
1654
|
raise TypeError
|
1324
1655
|
|
1325
|
-
def __get__(self, instance, owner): # noqa
|
1656
|
+
def __get__(self, instance, owner=None): # noqa
|
1326
1657
|
bound = instance.__dict__[self._fn.__name__] = self.__class__(self._fn.__get__(instance, owner))
|
1327
1658
|
return bound
|
1328
1659
|
|
@@ -2081,13 +2412,6 @@ json_dump_compact: ta.Callable[..., None] = functools.partial(json.dump, **JSON_
|
|
2081
2412
|
json_dumps_compact: ta.Callable[..., str] = functools.partial(json.dumps, **JSON_COMPACT_KWARGS)
|
2082
2413
|
|
2083
2414
|
|
2084
|
-
########################################
|
2085
|
-
# ../../../../../omlish/lite/logs.py
|
2086
|
-
|
2087
|
-
|
2088
|
-
log = logging.getLogger(__name__)
|
2089
|
-
|
2090
|
-
|
2091
2415
|
########################################
|
2092
2416
|
# ../../../../../omlish/lite/objects.py
|
2093
2417
|
|
@@ -2333,13 +2657,6 @@ def split_keep_delimiter(s, d):
|
|
2333
2657
|
##
|
2334
2658
|
|
2335
2659
|
|
2336
|
-
def attr_repr(obj: ta.Any, *attrs: str) -> str:
|
2337
|
-
return f'{type(obj).__name__}({", ".join(f"{attr}={getattr(obj, attr)!r}" for attr in attrs)})'
|
2338
|
-
|
2339
|
-
|
2340
|
-
##
|
2341
|
-
|
2342
|
-
|
2343
2660
|
FORMAT_NUM_BYTES_SUFFIXES: ta.Sequence[str] = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB']
|
2344
2661
|
|
2345
2662
|
|
@@ -2356,13 +2673,24 @@ def format_num_bytes(num_bytes: int) -> str:
|
|
2356
2673
|
|
2357
2674
|
|
2358
2675
|
########################################
|
2359
|
-
# ../../../../../omlish/logs/
|
2676
|
+
# ../../../../../omlish/logs/modules.py
|
2677
|
+
|
2678
|
+
|
2679
|
+
##
|
2680
|
+
|
2681
|
+
|
2682
|
+
def get_module_logger(mod_globals: ta.Mapping[str, ta.Any]) -> logging.Logger:
|
2683
|
+
return logging.getLogger(mod_globals.get('__name__'))
|
2684
|
+
|
2685
|
+
|
2686
|
+
########################################
|
2687
|
+
# ../../../../../omlish/logs/std/filters.py
|
2360
2688
|
|
2361
2689
|
|
2362
2690
|
##
|
2363
2691
|
|
2364
2692
|
|
2365
|
-
class
|
2693
|
+
class TidLoggingFilter(logging.Filter):
|
2366
2694
|
def filter(self, record):
|
2367
2695
|
# FIXME: handle better - missing from wasm and cosmos
|
2368
2696
|
if hasattr(threading, 'get_native_id'):
|
@@ -2373,13 +2701,13 @@ class TidLogFilter(logging.Filter):
|
|
2373
2701
|
|
2374
2702
|
|
2375
2703
|
########################################
|
2376
|
-
# ../../../../../omlish/logs/proxy.py
|
2704
|
+
# ../../../../../omlish/logs/std/proxy.py
|
2377
2705
|
|
2378
2706
|
|
2379
2707
|
##
|
2380
2708
|
|
2381
2709
|
|
2382
|
-
class
|
2710
|
+
class ProxyLoggingFilterer(logging.Filterer):
|
2383
2711
|
def __init__(self, underlying: logging.Filterer) -> None: # noqa
|
2384
2712
|
self._underlying = underlying
|
2385
2713
|
|
@@ -2405,9 +2733,9 @@ class ProxyLogFilterer(logging.Filterer):
|
|
2405
2733
|
return self._underlying.filter(record)
|
2406
2734
|
|
2407
2735
|
|
2408
|
-
class
|
2736
|
+
class ProxyLoggingHandler(ProxyLoggingFilterer, logging.Handler):
|
2409
2737
|
def __init__(self, underlying: logging.Handler) -> None: # noqa
|
2410
|
-
|
2738
|
+
ProxyLoggingFilterer.__init__(self, underlying)
|
2411
2739
|
|
2412
2740
|
_underlying: logging.Handler
|
2413
2741
|
|
@@ -3068,6 +3396,9 @@ class AwsDataclassMeta:
|
|
3068
3396
|
# ../cursor.py
|
3069
3397
|
|
3070
3398
|
|
3399
|
+
log = get_module_logger(globals()) # noqa
|
3400
|
+
|
3401
|
+
|
3071
3402
|
##
|
3072
3403
|
|
3073
3404
|
|
@@ -3127,6 +3458,9 @@ TODO:
|
|
3127
3458
|
"""
|
3128
3459
|
|
3129
3460
|
|
3461
|
+
log = get_module_logger(globals()) # noqa
|
3462
|
+
|
3463
|
+
|
3130
3464
|
##
|
3131
3465
|
|
3132
3466
|
|
@@ -4618,7 +4952,7 @@ def check_lite_runtime_version() -> None:
|
|
4618
4952
|
|
4619
4953
|
|
4620
4954
|
########################################
|
4621
|
-
# ../../../../../omlish/logs/json.py
|
4955
|
+
# ../../../../../omlish/logs/std/json.py
|
4622
4956
|
"""
|
4623
4957
|
TODO:
|
4624
4958
|
- translate json keys
|
@@ -4628,7 +4962,7 @@ TODO:
|
|
4628
4962
|
##
|
4629
4963
|
|
4630
4964
|
|
4631
|
-
class
|
4965
|
+
class JsonLoggingFormatter(logging.Formatter):
|
4632
4966
|
KEYS: ta.Mapping[str, bool] = {
|
4633
4967
|
'name': False,
|
4634
4968
|
'msg': False,
|
@@ -4849,6 +5183,9 @@ class AwsLogMessageBuilder:
|
|
4849
5183
|
# ../../../../journald/messages.py
|
4850
5184
|
|
4851
5185
|
|
5186
|
+
log = get_module_logger(globals()) # noqa
|
5187
|
+
|
5188
|
+
|
4852
5189
|
##
|
4853
5190
|
|
4854
5191
|
|
@@ -4957,6 +5294,7 @@ def load_config_file_obj(
|
|
4957
5294
|
# ../../../../../omlish/logs/standard.py
|
4958
5295
|
"""
|
4959
5296
|
TODO:
|
5297
|
+
- !! move to std !!
|
4960
5298
|
- structured
|
4961
5299
|
- prefixed
|
4962
5300
|
- debug
|
@@ -4978,7 +5316,7 @@ STANDARD_LOG_FORMAT_PARTS = [
|
|
4978
5316
|
]
|
4979
5317
|
|
4980
5318
|
|
4981
|
-
class
|
5319
|
+
class StandardLoggingFormatter(logging.Formatter):
|
4982
5320
|
@staticmethod
|
4983
5321
|
def build_log_format(parts: ta.Iterable[ta.Tuple[str, str]]) -> str:
|
4984
5322
|
return ' '.join(v for k, v in parts)
|
@@ -4997,7 +5335,7 @@ class StandardLogFormatter(logging.Formatter):
|
|
4997
5335
|
##
|
4998
5336
|
|
4999
5337
|
|
5000
|
-
class
|
5338
|
+
class StandardConfiguredLoggingHandler(ProxyLoggingHandler):
|
5001
5339
|
def __init_subclass__(cls, **kwargs):
|
5002
5340
|
raise TypeError('This class serves only as a marker and should not be subclassed.')
|
5003
5341
|
|
@@ -5030,7 +5368,7 @@ def configure_standard_logging(
|
|
5030
5368
|
target: ta.Optional[logging.Logger] = None,
|
5031
5369
|
force: bool = False,
|
5032
5370
|
handler_factory: ta.Optional[ta.Callable[[], logging.Handler]] = None,
|
5033
|
-
) -> ta.Optional[
|
5371
|
+
) -> ta.Optional[StandardConfiguredLoggingHandler]:
|
5034
5372
|
with _locking_logging_module_lock():
|
5035
5373
|
if target is None:
|
5036
5374
|
target = logging.root
|
@@ -5038,7 +5376,7 @@ def configure_standard_logging(
|
|
5038
5376
|
#
|
5039
5377
|
|
5040
5378
|
if not force:
|
5041
|
-
if any(isinstance(h,
|
5379
|
+
if any(isinstance(h, StandardConfiguredLoggingHandler) for h in list(target.handlers)):
|
5042
5380
|
return None
|
5043
5381
|
|
5044
5382
|
#
|
@@ -5052,14 +5390,14 @@ def configure_standard_logging(
|
|
5052
5390
|
|
5053
5391
|
formatter: logging.Formatter
|
5054
5392
|
if json:
|
5055
|
-
formatter =
|
5393
|
+
formatter = JsonLoggingFormatter()
|
5056
5394
|
else:
|
5057
|
-
formatter =
|
5395
|
+
formatter = StandardLoggingFormatter(StandardLoggingFormatter.build_log_format(STANDARD_LOG_FORMAT_PARTS))
|
5058
5396
|
handler.setFormatter(formatter)
|
5059
5397
|
|
5060
5398
|
#
|
5061
5399
|
|
5062
|
-
handler.addFilter(
|
5400
|
+
handler.addFilter(TidLoggingFilter())
|
5063
5401
|
|
5064
5402
|
#
|
5065
5403
|
|
@@ -5072,7 +5410,7 @@ def configure_standard_logging(
|
|
5072
5410
|
|
5073
5411
|
#
|
5074
5412
|
|
5075
|
-
return
|
5413
|
+
return StandardConfiguredLoggingHandler(handler)
|
5076
5414
|
|
5077
5415
|
|
5078
5416
|
########################################
|
@@ -5109,6 +5447,9 @@ TODO:
|
|
5109
5447
|
"""
|
5110
5448
|
|
5111
5449
|
|
5450
|
+
log = get_module_logger(globals()) # noqa
|
5451
|
+
|
5452
|
+
|
5112
5453
|
##
|
5113
5454
|
|
5114
5455
|
|
@@ -5588,6 +5929,9 @@ $SYSTEMD_URLIFY
|
|
5588
5929
|
"""
|
5589
5930
|
|
5590
5931
|
|
5932
|
+
log = get_module_logger(globals()) # noqa
|
5933
|
+
|
5934
|
+
|
5591
5935
|
##
|
5592
5936
|
|
5593
5937
|
|
@@ -5731,6 +6075,9 @@ class Journald2AwsConfig:
|
|
5731
6075
|
"""
|
5732
6076
|
|
5733
6077
|
|
6078
|
+
log = get_module_logger(globals()) # noqa
|
6079
|
+
|
6080
|
+
|
5734
6081
|
##
|
5735
6082
|
|
5736
6083
|
|