forked from CUBigDataClass/newsbuff-datafetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsampleEmitlogsBackend.py
16 lines (12 loc) · 1003 Bytes
/
sampleEmitlogsBackend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# sample file that uses emitlogsBackend.py to publish backend logs to rabbitMQ backend queue - For reference
# Step 1: Import emitlogsBackend python file
import emitlogsBackend
# Step 2: Use two variables <var1> and <var2> to fetch "rabbitMQ connection" and "rabbitMQ client" details
rabbitMQChannel, rabbitMQ = emitlogsBackend.fetchConnection()
# Step 3: Use respective function calls to publish your respective info/debug/warning log messages into rabbitMQ backend queue
# by passing the parameters <log message> and <var1> obtained in Step 2
emitlogsBackend.log_info("Your info message - sample run example - info", rabbitMQChannel)
emitlogsBackend.log_debug("Your debug message - sample run - debug", rabbitMQChannel)
emitlogsBackend.log_warning("Your warning message - sample run - warning", rabbitMQChannel)
# Step 4: Close the channel connection using the following function by passing <var2> from Step 2 after completing logging operation.
emitlogsBackend.closeConnection(rabbitMQ)