Skip to content

Commit

Permalink
Update log file naming
Browse files Browse the repository at this point in the history
Include the parent folder in the file name and do not infer file name
from script name, but use the given NAME variable.
  • Loading branch information
m-appel committed Dec 19, 2024
1 parent f246e32 commit da0c054
Show file tree
Hide file tree
Showing 76 changed files with 76 additions and 217 deletions.
4 changes: 1 addition & 3 deletions iyp/crawlers/alice_lg/amsix.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.alice_lg import Crawler
Expand All @@ -15,11 +14,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/alice_lg/bcix.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.alice_lg import Crawler
Expand All @@ -15,11 +14,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/alice_lg/decix.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.alice_lg import Crawler
Expand All @@ -15,11 +14,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/alice_lg/ixbr.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.alice_lg import Crawler
Expand All @@ -15,11 +14,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/alice_lg/linx.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.alice_lg import Crawler
Expand All @@ -15,11 +14,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/alice_lg/megaport.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.alice_lg import Crawler
Expand All @@ -15,11 +14,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/alice_lg/netnod.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.alice_lg import Crawler
Expand All @@ -15,11 +14,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/apnic/eyeball.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

import iso3166
Expand Down Expand Up @@ -94,11 +93,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/bgpkit/as2rel_v4.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.bgpkit import AS2RelCrawler
Expand All @@ -22,11 +21,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/bgpkit/as2rel_v6.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.bgpkit import AS2RelCrawler
Expand All @@ -22,11 +21,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/bgpkit/peerstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import bz2
import json
import logging
import os
import sys
from datetime import datetime, time, timedelta, timezone

Expand Down Expand Up @@ -99,11 +98,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/bgpkit/pfx2asn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import bz2
import json
import logging
import os
import sys
from ipaddress import ip_network

Expand Down Expand Up @@ -69,11 +68,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
3 changes: 1 addition & 2 deletions iyp/crawlers/bgptools/anycast_prefixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/bgptools/as_names.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys
from io import BytesIO

Expand Down Expand Up @@ -94,11 +93,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/bgptools/tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys
from datetime import datetime, time, timezone

Expand Down Expand Up @@ -86,11 +85,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/caida/as_relationships_v4.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.caida import ASRelCrawler
Expand All @@ -20,11 +19,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/caida/as_relationships_v6.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import logging
import os
import sys

from iyp.crawlers.caida import ASRelCrawler
Expand All @@ -20,11 +19,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/caida/asrank.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import argparse
import json
import logging
import os
import sys
from datetime import datetime, timezone

Expand Down Expand Up @@ -115,11 +114,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/caida/ix_asns.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import argparse
import json
import logging
import os
import sys
from datetime import datetime, timezone

Expand Down Expand Up @@ -99,11 +98,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
4 changes: 1 addition & 3 deletions iyp/crawlers/caida/ixs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import ipaddress
import json
import logging
import os
import sys
from datetime import datetime, timezone

Expand Down Expand Up @@ -209,11 +208,10 @@ def main() -> None:
parser.add_argument('--unit-test', action='store_true')
args = parser.parse_args()

scriptname = os.path.basename(sys.argv[0]).replace('/', '_')[0:-3]
FORMAT = '%(asctime)s %(levelname)s %(message)s'
logging.basicConfig(
format=FORMAT,
filename='log/' + scriptname + '.log',
filename='log/' + NAME + '.log',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S'
)
Expand Down
Loading

0 comments on commit da0c054

Please sign in to comment.