4. Logging Smarty

4.1. Logs Smarty

Entries in the logs are as follows:

%(timestamp)% %(log level)% %(module)%:%(code line number)% %(function)%[%(pid)%.%(thread id)%] %(message text)%

The message (message text) consists of the name of events and additional context.

An example entry in the log:

Fri Mar 24 10:22:35+0300 2017 DEBUG api:621 get[83630.Thread-3] SOME_EVENT 'ip'='127.0.0.1' args=['foo', 'bar']

In this example:

Fri
day of the week
Mar
a month
24
date
10:22:35
local time in timezone specified in settings.py in the constant TIME_ZONE
+0300
the offset relative to UTC
2017
year
DEBUG
the level of logging
api:621
the file name and line number
get[83630.Thread-3]
the name of the function, the pid and the name of the thread
SOME_EVENT
event name
ip and args
additional context

The level of logging westvlaamse in the project settings(smarty/settings/settings_<local>.py). For example, to set the INFO level to log api requests, you must add the following code:

LOGGING['handlers']['smarty_api_requests_handler']['level'] = "INFO"

Events depending on type are grouped in different files. By default, logs are stored at the address /var/log/microimpuls/smarty/.

4.1.1. smarty_main - main log

Types of events:

URLS_INITIALIZED

Smarty configuration initialized. Occurs during the application start, additional context:

  • available_apps - available modules

Events that are unprocessed other loggers

Occurs during the error, you need to contact the developer to solve.

Additional context: local variables of the function in which the error occurred.

4.1.2. smarty_accounts - log subscribers

Types of events:

LOGIN_SUCCESS

A successful authorization, the context:

  • login_type - type login (multilogin, basic device, additional equipment)
  • login_method - the method login (and password pass only pass only the UID of the device)
  • params - the query parameters

LOGIN_ERROR

Authorization error, context:

  • reason - the cause of the error:
    • account_does_not_exist account there is no subscription or password is invalid or device_uid
    • account_is_not_active account is not active
    • client_does_not_exist - invalid api_key or client_id
    • basic_device_sessions_limit - exceeded session limit on the base unit
    • account_deivce_invalid - such a basic device already exists
    • external_api_error - request error to the external system (e.g. external billing)
    • unknown_error - unknown error (accompanied by stacktrace’ohms)
  • params - the query parameters

ACCOUNT_DEVICE_ERROR

Error when creating a device account context:

  • account - account
  • device - device
  • device_uid - the UID of the device
  • client - operator

ACCOUNT_ACTIVATED

Account has been activated, the context:

  • activation_result - the answer returned by the external system
  • params - the query parameters

ACCOUNT_CREATED

Create account context:

  • account_id - the account ID

ACCOUNT_CHANGED

Change the account context:

  • account_id - the account ID
  • changed fields

ACCOUNT_TARIFFS_ASSIGNED

Adding tariffs account context:

  • account_id - the account ID
  • tariffs_ids - the list of IDs of the connected tariffs

ACCOUNT_TARIFFS_REMOVED

The removal of tariffs to the account context:

  • account_id - the account ID
  • tariffs_ids - the list of IDs of deleted rates

CUSTOMER_CREATED

Create subscriber context:

  • customer_id caller ID

CUSTOMER_CHANGED

The change of the subscriber context:

  • customer_id caller ID
  • changed fields

CUSTOMER_TARIFFS_ASSIGNED

Adding tariffs to the subscriber, the context:

  • customer_id caller ID
  • tariffs_ids - the list of IDs of the connected tariffs

CUSTOMER_TARIFFS_REMOVED

The removal of tariffs subscriber context:

  • customer_id caller ID
  • tariffs_ids - the list of IDs of deleted rates

ACCOUNT_DEVICE_REMOVED

Delete the device account context:

  • account_id - the account ID
  • device_uid - the device ID

4.1.3. smarty_billing_out requests to external systems

INIT_ERROR

Error initializing API handler, context:

  • kwargs - the arguments passed in the handler class
  • api_client_class - the class name of the handler API
  • stacktrace

CUSTOMER_BALANCE_REQUEST_ERROR

Error balance inquiry, context:

  • api_client_class - the class name of the handler API
  • params - the query parameters
  • stacktrace

CUSTOMER_BALANCE_REQUEST_SUCCESS

A successful balance inquiry, context:

  • api_client_class - the class name of the handler API
  • params - the query parameters
  • result - the result of the query

CUSTOMER_PAYMENT_LIST_REQUEST_ERROR

Error when requesting list of transactions that context:

  • api_client_class - the class name of the handler API
  • params - the query parameters
  • stacktrace

CUSTOMER_PAYMENT_LIST_REQUEST_SUCCESS

A successful list request transaction context:

  • api_client_class - the class name of the handler API
  • params - the query parameters
  • result - the query result

VIDEO_ACTIONS_LIST_REQUEST_ERROR

Error query options with the video context:

  • api_client_class - the class name of the handler API
  • params - the query parameters
  • stacktrace

VIDEO_ACTIONS_LIST_REQUEST_SUCCESS

A successful query options with the video context:

  • api_client_class - the class name of the handler API
  • params - the query parameters
  • result - the query result

VIDEO_ACTION_REQUEST_ERROR

Error when trying to perform an action with the video context:

  • api_client_class - the class name of the handler API
  • params - the query parameters
  • stacktrace

VIDEO_ACTION_REQUEST_SUCCESS

Successful action with the video context:

  • api_client_class - the class name of the handler API
  • params - the query parameters
  • result - the query result

4.1.4. smarty_billing_in incoming requests to the Billing API

BILLING_REQUEST_ERROR

Error when querying the Billing API context:

  • url - URL method, which made the request
  • the ip - the IP address from which the request proizvodite
  • args - arguments of the request
  • error_message - error message
  • ``”error” `` - error code

BILLING_REQUEST_SUCCESS

A successful request to the billing system, the context:

  • url - URL method, which made the request
  • the ip - the IP address from which the request proizvodite
  • args - arguments of the request

4.1.5. smarty_cache events related to caching

OBJECT_CACHED

Cached object, context:

  • object - cached object
  • timeout - the time after which the object will be removed from the cache
  • key key object in the cache
  • deps - objects, changing of which the cached object should be invalizilor

OBJECT_INVALIDATED

Invalizilor object, context:

  • object - the object that was removed from the cache
  • deps_key - the key of the object, where the keys of related objects, which must also be Invalidovna

4.1.6. smarty_messaging - log sent messages for accounts

MESSAGE_CREATED

Created message context:

  • account - the account to which the message was sent
  • subject - the subject of the message
  • text - the message text

MESSAGE_SEND

The message was sent, the context:

  • account - the account to which the message was sent
  • subject - the subject of the message
  • text - the message text
  • uuid - the message ID

MESSAGE_DELETED

Message deleted, additional context:

  • account - the account to which the message was sent
  • subject - the subject of the message
  • text - the message text
  • uuid - the message ID

4.1.7. smarty_management - log periodic commands

MANAGEMENT_COMMAND_SUCCESS

Successful execution of the command, additional context:

  • command - the team name
  • execution_time - run time

MANAGEMENT_COMMAND_ERROR

Error executing the command for more context:

  • command - the team name
  • stacktrace

4.1.8. smarty_epg - log import EPG

EPG_CHANNEL_IMPORTED

Programs for channel imported successfully, more context:

  • epg_channel - channel
  • source - the EPG source
  • programs_imported - the number of imported programmes

EPG_CHANNEL_IMPORT_ERROR

Error when importing programs, additional context:

  • epg_channel - channel
  • source - the EPG source
  • stacktrace

EPG_IMPORT_FINISHED

Import programs are completed, additional context:

  • channels_processed - the number of processed channels
  • programms_imported - the number of imported programmes

EPG_REMOVED

In the course of parsing have been removed the old entry for more context:

  • epg_channel - channel
  • source - the epg source
  • removed_objects - deleted objects

EPG_TIME_OVERLAP

The end time of the previous program start time of the current, more context:

  • epg_channel - channel
  • source - the epg source
  • program_name - the name of the program
  • previous_program_name - the name of the previous program
  • program_time_begin - the start time of the current program
  • previous_time_end - the end time of the previous program

EPG_TIME_HOLE

The end time of the previous program start time less the current, more context:

  • epg_channel - channel
  • source - the epg source
  • program_name - the name of the program
  • previous_program_name - the name of the previous program
  • program_time_begin - the start time of the current program
  • previous_time_end - the end time of the previous program

EPG_NAME_DOUBLE

The name of the current program coincides with the previous one, the additional context:

  • epg_channel - channel
  • source - the epg source
  • program_name - the name of the program

4.1.9. smarty_content_requests - requests for links to/addresses of the stream using TVMW API

CONTENT_REQUEST_FAIL

Has encountered an unhandled error in the request process, you must contact the developer.

Additional context:

  • url - URL method, which made the request
  • params - the query parameters
  • stacktrace

CONTENT_REQUEST_ERROR

Processed error in the request process, additional context:

  • url - URL method, which made the request
  • params - the query parameters

Possible causes:

  • invalid request parameters
  • legacy authorization key
  • request to ustravel data (for example, trying to play too old transfer from archive)

CONTENT_REQUEST_SUCCESS

A successful query, link the received additional context:

  • url - URL method, which made the request
  • params - the query parameters
  • additional information, including the address of the thread (depending on method)

CLIENT_CHANNELS_NOT_FOUND

Not found in the cache channels for a given Client ID may have been reset cache or an error occurred executing the command cache_channel_list, additional context:

  • client - Client ID

4.1.10. smarty_portal - log events portal

PORTAL_EVENT

The event in the portal additional context:

  • event_description - the event description
  • the ip - the IP address of the device of the subscriber
  • device_uid - the device ID
  • screen_name - title screen
  • user_agent - User-Agent device

4.1.11. smarty_stream_services - log-streaming-services

STREAM_SERVICE_CHECKING_ERROR

Error checking of availability of the streaming service, for more context:

  • stream_service - streaming service
  • was_available_before - indicates whether a streaming service available earlier
  • check_ping_success - was a successful test of ping (optional)
  • check_tcp_success- whether successful verification attempt to open socket (optional)
  • check_http_success - whether successful verification attempt to access the URL (optional)
  • check_is_alive_success - whether successful test is_alive (optional)
  • stacktrace

STREAM_SERVICE_CHECKING_SUCCESS

Successful checking of availability of the streaming service, for more context:

  • stream_service - streaming service
  • was_available_before - indicates whether a streaming service available earlier
  • check_ping_success - the ping test was successful (optional)
  • check_tcp_success- check the attempt to open the socket was successful (optional)
  • check_http_success - check by trying to open a URL was successful (optional)
  • check_is_alive_success - check is_alive was successful (optional)

4.1.12. smarty_admin - log admin panel Smarty

ADMIN_REQUEST

Query the administration interface, additional context:

  • user - the user who typed the query
  • the ip - the IP of the consumers
  • path - the request path
  • user_agent - User-Agent browser

4.1.13. smarty_videoservices - log of requests to video

VIDEOSERVICES_REQUEST

The user’s query in Smarty to run the command:

  • the ip - the IP of the consumers
  • user_agent - User-Agent browser
  • user - the user who typed the query
  • path - the request path

VIDEOSERVICES_API_REQUEST

The Smarty request to the video service:

  • the host - the type and address of video service
  • args - arguments of the request
  • command - the called method
  • message - the server’s response (only if error)

4.1.14. smarty_payment - лог оплаты

NOTIFY_ERROR

Ошибка обработки сообщения нотификации, дополнительный контекст:

  • client - ID клиента в платёжном шлюзе.
  • transaction - ID транзакции.
  • payment_source - название платёжного шлюза.
  • params - параметры запроса.
  • error - описание ошибки.

Возможные причины ошибки:

  • Неверная настройка платёжного шлюза.
  • Передача неверных параметров платёжному шлюзу.
  • Платёж не прошёл.

NOTIFY_SUCCESS

Успешная нотификация, дополнительный контекст:

  • client - ID клиента в платёжном шлюзе.
  • transaction - ID транзакции.
  • payment_source - название платёжного шлюза.
  • params - параметры запроса.

PAYTURE_REQUEST

Запрос к платёжному шлюзу Payture:

  • url - URL API Payture, на который выполняется запрос.
  • args - аргументы запроса.
  • response - ответ от API в виде XML.