Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Redner Odoo Module
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
Redner Odoo Module
Commits
556b37a79d44
Commit
556b37a79d44
authored
3 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
Improve logging
Request contents only logged at debug level. Fixes
#1
.
parent
3b3e77aff06f
No related branches found
Branches containing commit
Tags
11.0.2.8.0
Tags containing commit
1 merge request
!11
Topic/11.0/zouzou
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NEWS.rst
+5
-0
5 additions, 0 deletions
NEWS.rst
__manifest__.py
+1
-1
1 addition, 1 deletion
__manifest__.py
models/redner.py
+11
-5
11 additions, 5 deletions
models/redner.py
with
17 additions
and
6 deletions
NEWS.rst
+
5
−
0
View file @
556b37a7
...
...
@@ -2,6 +2,11 @@
NEWS
====
11.0.2.4.1
==========
* Improve logging - request contents only logged at debug level.
11.0.2.4.0
==========
...
...
This diff is collapsed.
Click to expand it.
__manifest__.py
+
1
−
1
View file @
556b37a7
...
...
@@ -21,7 +21,7 @@
"
name
"
:
"
Redner
"
,
"
summary
"
:
"""
Allows to generate transactional emails and documents in PDF or HTML format
"""
,
"
version
"
:
"
11.0.2.4.
0
"
,
"
version
"
:
"
11.0.2.4.
1
"
,
"
author
"
:
"
XCG Consulting
"
,
"
category
"
:
"
Technical
"
,
"
description
"
:
"""
...
...
This diff is collapsed.
Click to expand it.
models/redner.py
+
11
−
5
View file @
556b37a7
...
...
@@ -41,6 +41,7 @@
return
self
.
call_impl
(
path
,
http_verb
=
http_verb
,
**
params
)
except
Exception
as
error
:
if
retry_counter
==
MAX_REDNERD_TRIES
-
1
:
logger
.
error
(
"
Redner error: %s
"
,
str
(
error
))
raise
error
def
call_impl
(
self
,
path
,
http_verb
=
"
post
"
,
**
params
):
...
...
@@ -51,6 +52,8 @@
path(str): URL path to query, eg.
'
/template/
'
http_verb(str): http verb to use, default:
'
post
'
params(dict): json payload
This method can raise anything; callers are expected to catch.
"""
if
not
self
.
server_url
:
...
...
@@ -59,6 +62,6 @@
"
Please add it in odoo.conf or in ir.config_parameter
"
)
endpoint
=
urljoin
(
self
.
server_url
,
path
)
url
=
urljoin
(
self
.
server_url
,
path
)
_http_verb
=
http_verb
.
upper
()
...
...
@@ -63,6 +66,7 @@
_http_verb
=
http_verb
.
upper
()
logger
.
info
(
"
%s to %s: %s
"
%
(
_http_verb
,
endpoint
,
params
))
logger
.
info
(
"
Redner: Calling %s...
"
,
_http_verb
)
logger
.
debug
(
"
Redner: Sending to %s > %s
"
,
url
,
params
)
start
=
time
.
time
()
r
=
getattr
(
self
.
session
,
http_verb
,
"
post
"
)(
...
...
@@ -66,8 +70,8 @@
start
=
time
.
time
()
r
=
getattr
(
self
.
session
,
http_verb
,
"
post
"
)(
endpoint
,
json
=
params
,
headers
=
{
"
Rednerd-API-Key
"
:
self
.
api_key
}
url
,
json
=
params
,
headers
=
{
"
Rednerd-API-Key
"
:
self
.
api_key
}
)
complete_time
=
time
.
time
()
-
start
logger
.
info
(
...
...
@@ -70,7 +74,8 @@
)
complete_time
=
time
.
time
()
-
start
logger
.
info
(
"
Received %s in %.2fms: %s
"
%
(
r
.
status_code
,
complete_time
*
1000
,
r
.
text
)
"
Redner: Received %s in %.2fms.
"
,
r
.
status_code
,
complete_time
*
1000
,
)
...
...
@@ -76,4 +81,5 @@
)
logger
.
debug
(
"
Redner: Received %s
"
,
r
.
text
)
try
:
response
=
r
.
json
()
...
...
This diff is collapsed.
Click to expand it.
Houzefa Abbasbhay
@houzefa.abba
mentioned in commit
012c424ba04b
·
3 years ago
mentioned in commit
012c424ba04b
mentioned in commit 012c424ba04b6dc5a3ddd4c9c4c37a581e295ab7
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment