diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-31 06:56:40 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-31 06:56:40 +0000 |
commit | e252f9d444f45447f1e845abce7604ee78713096 (patch) | |
tree | 4d18cdabe820ba6449f09bcfc0f9f12c9a47a46b | |
parent | 6b218e7509ce328271966e76aaf5c5acf3adc192 (diff) |
automatic import of python-viewlogger
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-viewlogger.spec | 423 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 425 insertions, 0 deletions
@@ -0,0 +1 @@ +/ViewLogger-2.2.2.tar.gz diff --git a/python-viewlogger.spec b/python-viewlogger.spec new file mode 100644 index 0000000..1b39fea --- /dev/null +++ b/python-viewlogger.spec @@ -0,0 +1,423 @@ +%global _empty_manifest_terminate_build 0 +Name: python-ViewLogger +Version: 2.2.2 +Release: 1 +Summary: Log view hits over time so that you know who enter this view and when. +License: MIT +URL: https://github.com/mahmoodnasr/ViewLogger/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a7/b1/c498d2a64feca41041f6db9a73c4adf1d482d116b09f15d1969bfc3342fa/ViewLogger-2.2.2.tar.gz +BuildArch: noarch + +Requires: python3-Django +Requires: python3-simplejson +Requires: python3-django-tables2 + +%description +# View Logger + +ViewLogger is a simple Django app Log view hits over time so that you know who enter this view and when. + +## Installation + +* Install the package +```sh +pip install ViewLogger +pip install unicodecsv +``` +* Add Application to your project's INSTALLED_APPs +```python +INSTALLED_APPS = ( + '....', + 'ViewLogger', + ) +``` +* Add `ViewLogger.middleware.ViewLoggerMiddleware` to your Middleware classes . +```python +MIDDLEWARE_CLASSES = ( + '....', + 'ViewLogger.middleware.ViewLoggerMiddleware', + ) +``` + +* Run Migrations +```sh + python manage.py migrate ViewLogger +``` + +#### Notes +* To exempt urls add VIEWLOGGER_EXEMPTED_PATHS to your setting.py +```python +VIEWLOGGER_EXEMPTED_PATHS=["/worker",] +``` + +* To exempt views add VIEWLOGGER_EXEMPTED_VIEWS to your setting.py +```python +VIEWLOGGER_EXEMPTED_VIEWS=["worker",] +``` + +* To exempt parameters add VIEWLOGGER_EXEMPTED_PARAMETER to your setting.py +```python +VIEWLOGGER_EXEMPTED_PARAMETER=["password",] +``` + +* ViewLogger by dafualt log all requests (GET and POST), add VIEWLOGGER_METHODS in your setting.py to log certain method , +```python +VIEWLOGGER_METHODS=["POST"] +``` + +* Save Request Duration +```python +VIEWLOGGER_SAVE_DURATION = False +``` + +* To archive/load ViewLogger_Log table add VIEWLOGGER_ARCHIVE_DIR to your setting.py +```python +VIEWLOGGER_ARCHIVE_DIR = os.path.join(BASE_DIR, "ViewLoggerArchive") +``` +Then run to archive data +```python + python manage.py ArchiveViewLoggerTable +``` + you will find JSON file named From_(first date in ViewLogger table)_To_(last date in ViewLogger table).json file for example : From_2018-01-01_To_2018-12-01.json + and the table is empty now and the auto_increment is reset + + or run to load the data you have archived from one file +```python + python manage.py LoadViewLoggerArchivedData.py --file=file_name +``` +or more than one file +```python + python manage.py LoadViewLoggerTable.py --files="file1_name,file2_name,file3_name" +``` + +* To search in ViewLogger archived files +```python + python manage.py SearchInViewLoggerArchives --done_by=mahmood --done_on=2018-12-01 +``` + with parameter available with examples : + ```python + --done_by=mahmood + --done_on=date + --url=path/to/view + --view_kwargs=key1=val1,key2=val2, + --view_args=arg1=val1,arg2=val2, + --view_name=view_name + --request_body=key1=val1,key2=val2, + --request_method=GET + ``` + the output will generate json object with the values for example : +```json + File = From_2018-01-01_To_2018-12-01.json +{ + "view_args": [], + "view_kwargs": { + "testid": "40478" + }, + "request_body": { + "requestby": "mahmood", + "resultcode": "1" + }, + "url": "/path/to/view", + "done_on": "2018-12-01 12:12:12.142001", + "view_name": "Edit", + "done_by": "mahmood", + "request_method": "POST", + "id": 498 +} +``` + and you can save the putput in file for example : +```python + python manage.py SearchInViewLoggerArchives --done_by=mahmood --done_on=2018-12-01 > /path/to/output.json +``` + + +%package -n python3-ViewLogger +Summary: Log view hits over time so that you know who enter this view and when. +Provides: python-ViewLogger +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-ViewLogger +# View Logger + +ViewLogger is a simple Django app Log view hits over time so that you know who enter this view and when. + +## Installation + +* Install the package +```sh +pip install ViewLogger +pip install unicodecsv +``` +* Add Application to your project's INSTALLED_APPs +```python +INSTALLED_APPS = ( + '....', + 'ViewLogger', + ) +``` +* Add `ViewLogger.middleware.ViewLoggerMiddleware` to your Middleware classes . +```python +MIDDLEWARE_CLASSES = ( + '....', + 'ViewLogger.middleware.ViewLoggerMiddleware', + ) +``` + +* Run Migrations +```sh + python manage.py migrate ViewLogger +``` + +#### Notes +* To exempt urls add VIEWLOGGER_EXEMPTED_PATHS to your setting.py +```python +VIEWLOGGER_EXEMPTED_PATHS=["/worker",] +``` + +* To exempt views add VIEWLOGGER_EXEMPTED_VIEWS to your setting.py +```python +VIEWLOGGER_EXEMPTED_VIEWS=["worker",] +``` + +* To exempt parameters add VIEWLOGGER_EXEMPTED_PARAMETER to your setting.py +```python +VIEWLOGGER_EXEMPTED_PARAMETER=["password",] +``` + +* ViewLogger by dafualt log all requests (GET and POST), add VIEWLOGGER_METHODS in your setting.py to log certain method , +```python +VIEWLOGGER_METHODS=["POST"] +``` + +* Save Request Duration +```python +VIEWLOGGER_SAVE_DURATION = False +``` + +* To archive/load ViewLogger_Log table add VIEWLOGGER_ARCHIVE_DIR to your setting.py +```python +VIEWLOGGER_ARCHIVE_DIR = os.path.join(BASE_DIR, "ViewLoggerArchive") +``` +Then run to archive data +```python + python manage.py ArchiveViewLoggerTable +``` + you will find JSON file named From_(first date in ViewLogger table)_To_(last date in ViewLogger table).json file for example : From_2018-01-01_To_2018-12-01.json + and the table is empty now and the auto_increment is reset + + or run to load the data you have archived from one file +```python + python manage.py LoadViewLoggerArchivedData.py --file=file_name +``` +or more than one file +```python + python manage.py LoadViewLoggerTable.py --files="file1_name,file2_name,file3_name" +``` + +* To search in ViewLogger archived files +```python + python manage.py SearchInViewLoggerArchives --done_by=mahmood --done_on=2018-12-01 +``` + with parameter available with examples : + ```python + --done_by=mahmood + --done_on=date + --url=path/to/view + --view_kwargs=key1=val1,key2=val2, + --view_args=arg1=val1,arg2=val2, + --view_name=view_name + --request_body=key1=val1,key2=val2, + --request_method=GET + ``` + the output will generate json object with the values for example : +```json + File = From_2018-01-01_To_2018-12-01.json +{ + "view_args": [], + "view_kwargs": { + "testid": "40478" + }, + "request_body": { + "requestby": "mahmood", + "resultcode": "1" + }, + "url": "/path/to/view", + "done_on": "2018-12-01 12:12:12.142001", + "view_name": "Edit", + "done_by": "mahmood", + "request_method": "POST", + "id": 498 +} +``` + and you can save the putput in file for example : +```python + python manage.py SearchInViewLoggerArchives --done_by=mahmood --done_on=2018-12-01 > /path/to/output.json +``` + + +%package help +Summary: Development documents and examples for ViewLogger +Provides: python3-ViewLogger-doc +%description help +# View Logger + +ViewLogger is a simple Django app Log view hits over time so that you know who enter this view and when. + +## Installation + +* Install the package +```sh +pip install ViewLogger +pip install unicodecsv +``` +* Add Application to your project's INSTALLED_APPs +```python +INSTALLED_APPS = ( + '....', + 'ViewLogger', + ) +``` +* Add `ViewLogger.middleware.ViewLoggerMiddleware` to your Middleware classes . +```python +MIDDLEWARE_CLASSES = ( + '....', + 'ViewLogger.middleware.ViewLoggerMiddleware', + ) +``` + +* Run Migrations +```sh + python manage.py migrate ViewLogger +``` + +#### Notes +* To exempt urls add VIEWLOGGER_EXEMPTED_PATHS to your setting.py +```python +VIEWLOGGER_EXEMPTED_PATHS=["/worker",] +``` + +* To exempt views add VIEWLOGGER_EXEMPTED_VIEWS to your setting.py +```python +VIEWLOGGER_EXEMPTED_VIEWS=["worker",] +``` + +* To exempt parameters add VIEWLOGGER_EXEMPTED_PARAMETER to your setting.py +```python +VIEWLOGGER_EXEMPTED_PARAMETER=["password",] +``` + +* ViewLogger by dafualt log all requests (GET and POST), add VIEWLOGGER_METHODS in your setting.py to log certain method , +```python +VIEWLOGGER_METHODS=["POST"] +``` + +* Save Request Duration +```python +VIEWLOGGER_SAVE_DURATION = False +``` + +* To archive/load ViewLogger_Log table add VIEWLOGGER_ARCHIVE_DIR to your setting.py +```python +VIEWLOGGER_ARCHIVE_DIR = os.path.join(BASE_DIR, "ViewLoggerArchive") +``` +Then run to archive data +```python + python manage.py ArchiveViewLoggerTable +``` + you will find JSON file named From_(first date in ViewLogger table)_To_(last date in ViewLogger table).json file for example : From_2018-01-01_To_2018-12-01.json + and the table is empty now and the auto_increment is reset + + or run to load the data you have archived from one file +```python + python manage.py LoadViewLoggerArchivedData.py --file=file_name +``` +or more than one file +```python + python manage.py LoadViewLoggerTable.py --files="file1_name,file2_name,file3_name" +``` + +* To search in ViewLogger archived files +```python + python manage.py SearchInViewLoggerArchives --done_by=mahmood --done_on=2018-12-01 +``` + with parameter available with examples : + ```python + --done_by=mahmood + --done_on=date + --url=path/to/view + --view_kwargs=key1=val1,key2=val2, + --view_args=arg1=val1,arg2=val2, + --view_name=view_name + --request_body=key1=val1,key2=val2, + --request_method=GET + ``` + the output will generate json object with the values for example : +```json + File = From_2018-01-01_To_2018-12-01.json +{ + "view_args": [], + "view_kwargs": { + "testid": "40478" + }, + "request_body": { + "requestby": "mahmood", + "resultcode": "1" + }, + "url": "/path/to/view", + "done_on": "2018-12-01 12:12:12.142001", + "view_name": "Edit", + "done_by": "mahmood", + "request_method": "POST", + "id": 498 +} +``` + and you can save the putput in file for example : +```python + python manage.py SearchInViewLoggerArchives --done_by=mahmood --done_on=2018-12-01 > /path/to/output.json +``` + + +%prep +%autosetup -n ViewLogger-2.2.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-ViewLogger -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 2.2.2-1 +- Package Spec generated @@ -0,0 +1 @@ +7078af7bd5d87abddada2b3a7d0dad22 ViewLogger-2.2.2.tar.gz |