-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: offer more information of error
- offer more information of error with details and analysis - use pre-built cryptg docker image to accelerate building progress
- Loading branch information
1 parent
45bf165
commit 153d9a0
Showing
4 changed files
with
47 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
FROM python:3.8.16-alpine3.17 AS cryptg_builder | ||
RUN apk add --update --no-cache rustup build-base &&\ | ||
rustup-init -y &&\ | ||
source $HOME/.cargo/env &&\ | ||
pip install cryptg==0.4.0 | ||
|
||
FROM hlf01/cryptg:cryptg0.4.0-python3.8.16-alpine3.17 AS cryptg_builder | ||
FROM python:3.8.16-alpine3.17 | ||
WORKDIR /telegram-onedrive | ||
COPY ./ ./ | ||
RUN apk add --update --no-cache libgcc &&\ | ||
pip install --no-cache-dir telethon requests flask onedrivesdk==1.1.8 | ||
COPY --from=cryptg_builder /usr/local/lib/python3.8/site-packages/cryptg /usr/local/lib/python3.8/site-packages | ||
COPY --from=cryptg_builder /cryptg /usr/local/lib/python3.8/site-packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
from datetime import datetime | ||
from traceback import print_exc | ||
from io import StringIO | ||
|
||
log_path = 'log' | ||
|
||
def logger(message): | ||
with open(log_path, 'a') as log_file: | ||
time = datetime.now() | ||
message = '%s\n%s\n'%(time, message) | ||
if isinstance(message, Exception): | ||
message = StringIO() | ||
print_exc(file=message) | ||
message = message.getvalue() | ||
message = '%s\n%s\n' % (time, message) | ||
print(message, end='') | ||
log_file.write(message) | ||
log_file.write(message) | ||
return message |