How to use the xpra.log.Logger function in xpra

To help you get started, we’ve selected a few xpra examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dscho / Xpra / trunk / src / xpra / server / batch_delay_calculator.py View on Github external
# coding=utf8
# This file is part of Xpra.
# Copyright (C) 2012, 2013 Antoine Martin 
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import time
from math import sqrt

from xpra.log import Logger
log = Logger()

from xpra.server.stats.maths import queue_inspect, logp


def get_low_limit(mmap_enabled, window_dimensions):
    #the number of pixels which can be considered 'low' in terms of backlog.
    #Generally, just one full frame, (more with mmap because it is so fast)
    low_limit = 1024*1024
    ww, wh = window_dimensions
    if ww>0 and wh>0:
        low_limit = max(8*8, ww*wh)
    if mmap_enabled:
        #mmap can accumulate much more as it is much faster
        low_limit *= 4
    return low_limit
github dscho / Xpra / src / xpra / os_util.py View on Github external
def main():
    import logging
    logging.basicConfig(format="%(asctime)s %(message)s")
    logging.root.setLevel(logging.INFO)
    from xpra.log import Logger
    log = Logger("")
    sp = sys.platform
    log.info("platform_name(%s)=%s", sp, platform_name(sp, ""))
    log.info("get_machine_id()=%s", get_machine_id())
    log.info("get_hex_uuid()=%s", get_hex_uuid())
    log.info("get_int_uuid()=%s", get_int_uuid())
github dscho / Xpra / trunk / src / xpra / x11 / gtk_x11 / error.py View on Github external
# super-fast connections to the X server, everything running on fast
# computers... does being this careful to avoid sync's actually matter?)

__all__ = ["XError", "trap"]

import os

#run xpra in synchronized mode to debug X11 errors:
XPRA_SYNCHRONIZE = os.environ.get("XPRA_SYNCHRONIZE", "1")=="1"
#useful for debugging X11 errors that get swallowed:
XPRA_X11_DEBUG = os.environ.get("XPRA_X11_DEBUG", "0")!="0"

import gtk.gdk

from xpra.log import Logger
log = Logger()

class XError(Exception):
    def __init__(self, message):
        Exception.__init__(self)
        self.msg = message

    def __str__(self):
        return "XError: %s" % str(self.msg)


xerror_to_name = None
def XErrorToName(xerror):
    global xerror_to_name
    if type(xerror)!=int:
        return xerror
    try:
github dscho / Xpra / tags / v0.13.x / src / xpra / server / server_base.py View on Github external
# coding=utf8
# This file is part of Xpra.
# Copyright (C) 2011 Serviware (Arthur Huillet, )
# Copyright (C) 2010-2014 Antoine Martin 
# Copyright (C) 2008 Nathaniel Smith 
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import os.path
import sys
import time

from xpra.log import Logger
log = Logger("server")
keylog = Logger("keyboard")
focuslog = Logger("focus")

from xpra.keyboard.mask import DEFAULT_MODIFIER_MEANINGS
from xpra.server.server_core import ServerCore
from xpra.util import log_screen_sizes
from xpra.os_util import thread, get_hex_uuid
from xpra.util import typedict
from xpra.codecs.loader import PREFERED_ENCODING_ORDER, codec_versions, has_codec, get_codec
from xpra.codecs.codec_constants import get_PIL_encodings
from xpra.codecs.video_helper import getVideoHelper, ALL_VIDEO_ENCODER_OPTIONS, get_DEFAULT_VIDEO_ENCODERS, ALL_CSC_MODULE_OPTIONS, get_DEFAULT_CSC_MODULES
if sys.version > '3':
    unicode = str           #@ReservedAssignment


DETECT_LEAKS = os.environ.get("XPRA_DETECT_LEAKS", "0")=="1"
github dscho / Xpra / src / xpra / client / notifications / notifier_base.py View on Github external
# This file is part of Xpra.
# Copyright (C) 2011-2013 Antoine Martin 
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import os

from xpra.log import Logger
log = Logger()


class NotifierBase(object):

    def __init__(self):
        #posix only - but degrades ok on non-posix:
        self.dbus_id = os.environ.get("DBUS_SESSION_BUS_ADDRESS", "")

    def cleanup(self):
        pass

    def show_notify(self, dbus_id, tray, nid, app_name, replaces_nid, app_icon, summary, body, expire_timeout, may_retry=True):
        pass

    def close_notify(self, nid):
        pass
github dscho / Xpra / tags / v0.12.x / src / xpra / x11 / server.py View on Github external
init_x11_filter,             #@UnresolvedImport
                               cleanup_x11_filter,          #@UnresolvedImport
                               cleanup_all_event_receivers  #@UnresolvedImport
                               )
from xpra.x11.bindings.window_bindings import X11WindowBindings #@UnresolvedImport
X11Window = X11WindowBindings()
from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings #@UnresolvedImport
X11Keyboard = X11KeyboardBindings()
from xpra.x11.gtk_x11.window import OverrideRedirectWindowModel, SystemTrayWindowModel, Unmanageable
from xpra.x11.gtk_x11.error import trap

from xpra.log import Logger
log = Logger("server")
focuslog = Logger("server", "focus")
windowlog = Logger("server", "window")
cursorlog = Logger("server", "cursor")
traylog = Logger("server", "tray")
settingslog = Logger("x11", "xsettings")

import xpra
from xpra.util import nonl
from xpra.os_util import StringIOClass
from xpra.x11.x11_server_base import X11ServerBase, mouselog
from xpra.net.protocol import compressed_wrapper, Compressed


class DesktopManager(gtk.Widget):
    def __init__(self):
        gtk.Widget.__init__(self)
        self.set_property("can-focus", True)
        self.set_flags(gtk.NO_WINDOW)
        self._models = {}
github dscho / Xpra / tags / v0.12.x / src / xpra / x11 / gtk_x11 / window.py View on Github external
calc_constrained_size,                      #@UnresolvedImport
               )
from xpra.x11.gtk_x11.send_wm import (
                send_wm_take_focus,                         #@UnresolvedImport
                send_wm_delete_window)                      #@UnresolvedImport
from xpra.gtk_common.gobject_util import (AutoPropGObjectMixin,
                           one_arg_signal,
                           non_none_list_accumulator)
from xpra.x11.gtk_x11.error import trap, XError
from xpra.x11.gtk_x11.prop import prop_get, prop_set
from xpra.x11.gtk_x11.composite import CompositeHelper
from xpra.x11.gtk_x11.pointer_grab import PointerGrabHelper

from xpra.log import Logger
log = Logger("x11", "window")
focuslog = Logger("x11", "window", "focus")

if gtk.pygtk_version<(2,17):
    log.error("your version of PyGTK is too old - expect some bugs")


XNone = constants["XNone"]
CWX = constants["CWX"]
CWY = constants["CWY"]
CWWidth = constants["CWWidth"]
CWHeight = constants["CWHeight"]
IconicState = constants["IconicState"]
NormalState = constants["NormalState"]


#if you want to use a virtual screen bigger than 32767x32767
#you will need to change those values, but some broken toolkits
github dscho / Xpra / src / xpra / platform / darwin / paths.py View on Github external
def debug(*msg):
    """ delay import of logger to prevent cycles """
    from xpra.log import Logger
    log = Logger("util")
    log.debug(*msg)
    return None
github dscho / Xpra / tags / v0.12.x / src / xpra / client / ui_client_base.py View on Github external
import os
import sys
import time
import ctypes
import datetime

from xpra.log import Logger
log = Logger("client")
windowlog = Logger("client", "window")
paintlog = Logger("client", "paint")
focuslog = Logger("client", "focus")
soundlog = Logger("client", "sound")
traylog = Logger("client", "tray")
keylog = Logger("client", "keyboard")
workspacelog = Logger("client", "workspace")
dbuslog = Logger("client", "dbus")

from xpra.gtk_common.gobject_util import no_arg_signal
from xpra.deque import maxdeque
from xpra.client.client_base import XpraClientBase, EXIT_TIMEOUT, EXIT_MMAP_TOKEN_FAILURE
from xpra.client.client_tray import ClientTray
from xpra.client.keyboard_helper import KeyboardHelper
from xpra.platform import set_application_name
from xpra.platform.features import MMAP_SUPPORTED, SYSTEM_TRAY_SUPPORTED, CLIPBOARD_WANT_TARGETS, CLIPBOARD_GREEDY, CLIPBOARDS
from xpra.platform.gui import init as gui_init, ready as gui_ready, get_native_notifier_classes, get_native_tray_classes, get_native_system_tray_classes, get_native_tray_menu_helper_classes, ClientExtras
from xpra.codecs.loader import codec_versions, has_codec, get_codec, PREFERED_ENCODING_ORDER, ALL_NEW_ENCODING_NAMES_TO_OLD, OLD_ENCODING_NAMES_TO_NEW
from xpra.codecs.video_helper import getVideoHelper, ALL_VIDEO_DECODER_OPTIONS, NO_GFX_CSC_OPTIONS
from xpra.simple_stats import std_unit
from xpra.net.protocol import Compressed, use_lz4
from xpra.daemon_thread import make_daemon_thread
from xpra.os_util import thread, Queue, os_info, platform_name, get_machine_id, get_user_uuid
github dscho / Xpra / trunk / src / xpra / client / gl / gl_check.py View on Github external
#!/usr/bin/env python
# This file is part of Xpra.
# Copyright (C) 2012 Serviware (Arthur Huillet, )
# Copyright (C) 2012, 2013 Antoine Martin 
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import sys, os
import logging
from xpra.log import Logger, debug_if_env
log = Logger()
debug = debug_if_env(log, "XPRA_OPENGL_DEBUG")

required_extensions = ["GL_ARB_texture_rectangle", "GL_ARB_vertex_program"]

#warnings seem unavoidable on win32, so silence them
#(other platforms should fix their packages instead)
SILENCE_FORMAT_HANDLER_LOGGER = sys.platform.startswith("win") or sys.platform.startswith("darwin")

BLACKLIST = {"vendor" : ["nouveau", "Humper"]}

DEFAULT_HAS_ALPHA = not sys.platform.startswith("win") and not sys.platform.startswith("darwin")
HAS_ALPHA = os.environ.get("XPRA_ALPHA", DEFAULT_HAS_ALPHA) in (True, "1")
DEFAULT_DOUBLE_BUFFERED = 0
if sys.platform.startswith("win"):
    #needed on win32?
    DEFAULT_DOUBLE_BUFFERED = 1