File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 88import os
99import shutil
1010import sys
11-
12- __version__ = '0.9a'
11+ import uuid
12+ from pathlib import Path
1313
1414from csmlog .system_call import LoggedSystemCall
1515from csmlog .udp_handler import UdpHandler
1616from csmlog .udp_handler_receiver import UdpHandlerReceiver
1717
18+ __version__ = '0.10'
19+
20+
1821class CSMLogger (object ):
1922 '''
2023 object to wrap logging logic
@@ -108,7 +111,17 @@ def getDefaultSaveDirectoryWithName(cls, appName):
108111 if os .name == 'nt' :
109112 logFolder = os .path .join (os .path .expandvars ("%APPDATA%" ), appName )
110113 else :
111- logFolder = os .path .join ('/var/log/' , appName )
114+ tmpPath = Path (f'/var/log/{ uuid .uuid4 ()} ' )
115+ try :
116+ tmpPath .touch ()
117+ tmpPath .unlink ()
118+ tmpPath = tmpPath .parent
119+ except PermissionError :
120+ # can't use /var/log... try using ~/log/
121+ tmpPath = Path .home () / 'log'
122+ tmpPath .mkdir (exist_ok = True )
123+
124+ logFolder = tmpPath / appName
112125
113126 if not os .path .isdir (logFolder ):
114127 os .makedirs (logFolder )
Original file line number Diff line number Diff line change 1313 version = __version__ ,
1414 packages = ['csmlog' ],
1515 license = 'MIT License' ,
16- python_requires = '>=2.7 ' ,
16+ python_requires = '>=3.6 ' ,
1717 long_description = open ('README.md' ).read (),
1818 long_description_content_type = 'text/markdown' ,
1919 classifiers = [
2020 'Intended Audience :: Developers' ,
2121 'Natural Language :: English' ,
2222 'Operating System :: Microsoft :: Windows' ,
2323 'Programming Language :: Python' ,
24- 'Programming Language :: Python :: 2.7' ,
2524 'Programming Language :: Python :: 3' ,
2625 ],
2726 include_package_data = True ,
You can’t perform that action at this time.
0 commit comments