Completed
Push — main ( 25807a...2ed45a )
by Jochen
01:37
created

weitersager.util.start_thread()   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.2963

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
ccs 1
cts 3
cp 0.3333
rs 10
c 0
b 0
f 0
cc 1
nop 2
crap 1.2963
1
"""
2
weitersager.util
3
~~~~~~~~~~~~~~~~
4
5
Utilities
6
7
:Copyright: 2007-2020 Jochen Kupperschmidt
8
:License: MIT, see LICENSE for details.
9
"""
10
11 1
from datetime import datetime
12 1
from threading import Thread
13 1
from typing import Any, Callable, Dict, Sequence
14
15
16 1
def log(message: str, *args: Any, **kwargs: Dict[str, Any]) -> None:
17 1
    timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
18 1
    print(timestamp, message.format(*args, **kwargs))
19
20
21 1
def start_thread(target: Callable, name: str) -> None:
22
    """Create, configure, and start a new thread."""
23
    t = Thread(target=target, name=name, daemon=True)
24
    t.start()
25