Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config callback to change the log file when the config log_dir/log_name change. #2167

Merged
merged 1 commit into from Jul 6, 2014

Conversation

matham
Copy link
Member

@matham matham commented May 8, 2014

Fixes #2165.

You can test it with this example code:

from kivy.lang import Builder
from kivy.app import runTouchApp


kv = '''
#:import Config kivy.config.Config
#:import Logger kivy.logger.Logger
BoxLayout:
    orientation: 'vertical'
    TextInput:
        id: text
    Button:
        text: 'Update file'
        on_press: Config.set('kivy', 'log_name', text.text)
    Button:
        on_press: Logger.warning('Whatevs: a warning to you')
        text: 'emit warning'
'''

runTouchApp(Builder.load_string(kv))

There is a slight thing, when we import Config, some stuff already goes to the current log so when you then change the log file, it'll miss some lines. However, changing the config file directly before loading kivy will resolve that.

tito added a commit that referenced this pull request Jul 6, 2014
Add config callback to change the log file when the config log_dir/log_name change.
@tito tito merged commit 42b7424 into kivy:master Jul 6, 2014
@matham matham deleted the logger branch July 6, 2014 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logger ignores custom log_dir
2 participants