@testflightynoti · Post #38095 · 12.05.2026 г., 18:37
#Plane#Logging#App Join the Plane Logging App beta on ✈️#TestFlight 🔗 Link: https://testflight.apple.com/join/avuMNRpz Shared by Dimitri
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #381 · 23 окт.
Установить свойства виджета в PySide можно не только через соответствующие методы и конструктор класса. Можно их изменять с помощью метода setProperty по имени. btn = QPushButton("Click Me") btn.setProperty("flat", True) Это аналогично вызову btn.setFlat(True) Если указать несуществующее свойство, то оно просто создается btn.setProperty("btnType", "super") Получить его значение можно методом .property(name) btn_type = btn.property("btnType") Когда это может быть полезно? ▫️Можно просто хранить какие то данные в виджете и потом их доставать обратно widget = QWidget() widget.setProperty('my_data', 123) print(widget.property('my_data')) ▫️ Назначая эти свойства разным виджетам можно потом отличить виджеты во время итераци по ним. Например, найти все кнопки со свойством my_data="superbtn". Но ведь вместо кастомного свойства можно использовать objectName, будет тот же результат. Да, но y ObjectName есть ограничение - только строки. ▫️ Если нам потребуется не просто поиск а, например, сортировка по числу, то свойства позволяют нам это сделать. Поддерживается любой тип данных widget.setProperty('my_data', {'Key': 'value'}) widget.setProperty('order', 1) all_widgets.sort(key=w: w.property('order')) Но ведь Python позволяет всё вышеперечисленное сделать простым созданием атрибута у объекта widget.order = 1 widget.my_data = 123 Да, но я думаю что не надо объяснять почему не стоит так делать. К тому же, если у виджета нет свойства то метод .property(name) вернет None, а отсутствующий атрибут выбросит исключение. ▫️ Действительно полезное применение кастомным свойствам - контроль стилей. Здесь атрибутами не обойтись, нужны именно свойства. Дело в том, что в селекторах стилей можно указывать конкретные свойства виджетов на которые следует назначать стиль. Просто запустите этот код from PySide2.QtWidgets import * if __name__ == "__main__": app = QApplication([]) widget = QWidget(minimumWidth=300) layout = QVBoxLayout(widget) btn1 = QPushButton("Action 1") btn2 = QPushButton("Action 2") btn3 = QPushButton("Action 3", flat=True) layout.addWidget(btn1) layout.addWidget(btn2) layout.addWidget(btn3) # добавим кастомное свойство одной кнопке btn1.setProperty("btnType", "super") # добавляем стили widget.setStyleSheet( """ QPushButton[btnType="super"] { background-color: yellow; color: red; } QPushButton[flat="true"] { color: yellow; } """ ) widget.show() app.exec_() С помощью селектора мы избирательно назначили стили на конкретные кнопки. Как получить список всех кастомный свойств? Функция получения списка кастомных свойств отличается от получения дефолтных. def print_widget_dyn_properties(widget): for prop_name in widget.dynamicPropertyNames(): property_name = prop_name.data().decode() property_value = widget.property(property_name) print(f"{property_name}: {property_value}") #tricks#qt
Пребарај: #logging
@testflightynoti · Post #38095 · 12.05.2026 г., 18:37
#Plane#Logging#App Join the Plane Logging App beta on ✈️#TestFlight 🔗 Link: https://testflight.apple.com/join/avuMNRpz Shared by Dimitri
Hashtags
@djangoproject · Post #77 · 05.07.2016 г., 07:46
https://docs.python.org/2/library/logging.html This module defines functions and classes which implement a flexible event logging system for applications and libraries. The key benefit of having the #logging_API provided by a standard library module is that all Python modules can participate in logging, so your application log can include your own messages integrated with messages from third-party modules. The module provides a lot of functionality and flexibility. If you are unfamiliar with #logging, the best way to get to grips with it is to see the tutorials (see the links on the right). The basic classes defined by the module, together with their functions, are listed below. #Loggers expose the interface that application code directly uses. Handlers send the log records (created by loggers) to the appropriate destination. Filters provide a finer grained facility for determining which log records to output. Formatters specify the layout of log records in the final output.
Hashtags
@githubtrending · Post #14948 · 11.07.2025 г., 12:30
#go#logging#metrics#opentelemetry#tracing OpenTelemetry-Go is a tool for Go applications that helps you track how your software performs by collecting data like traces and metrics, then sending this information to monitoring platforms so you can see what’s happening inside your app in real time[2][3][4]. It works on many operating systems and Go versions, and you can use it by adding a few lines of code to your app and setting up an exporter. This makes it much easier to find and fix problems, understand how your app is running, and keep everything reliable and fast[2][3][4]. https://github.com/open-telemetry/opentelemetry-go
@githubtrending · Post #14846 · 20.06.2025 г., 12:00
#go#cloudnative#grafana#hacktoberfest#logging#loki#prometheus Loki is a log aggregation system inspired by Prometheus but designed specifically for logs instead of metrics. It is cost-effective and easy to operate because it only indexes metadata (labels) about logs, not the full log content, which reduces storage and complexity. Loki works well with Kubernetes by automatically indexing pod labels and integrates natively with Grafana for easy log visualization. Its stack includes an agent (Alloy) to collect logs, Loki to store and query them, and Grafana to display them. This setup helps you efficiently manage and analyze logs with less cost and simpler operation compared to traditional logging systems[2]. https://github.com/grafana/loki