Read MP Config inside plugin (1 Viewer)

Walzing

Portal Pro
November 15, 2008
187
9
Hi,

I have started to write a small plugin and now want to add some logging. But it seems I can't find any ressources, howto get the logging working. I have looked at MyTVServies and MovingPictures. But it seems they do their own logging stuff.
So I thought I could write to my own log, but I didn't find a function, that will give me the path to the current log path.
Is there a function to access the configuration?
 

jameson_uk

Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom

    Walzing

    Portal Pro
    November 15, 2008
    187
    9
    AW: Read MP Config inside plugin

    Thx alot - such a simple solution.
    I will use Mediaportal.log in first place.

    Just tested - but I seem to miss something:
    Code:
    2011-09-21 19:54:18.501992 [Info.][B][(7)][/B]: Starting Copy
    2011-09-21 19:54:18.531994 [Info.][MPMain(1)]:
    It only displays (7) instead of MyPlugin(7).
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Re: AW: Read MP Config inside plugin

    Thx alot - such a simple solution.
    I will use Mediaportal.log in first place.

    Just tested - but I seem to miss something:
    Code:
    2011-09-21 19:54:18.501992 [Info.][B][(7)][/B]: Starting Copy
    2011-09-21 19:54:18.531994 [Info.][MPMain(1)]:
    It only displays (7) instead of MyPlugin(7).

    The 7 is just an ID so ignore that. If you want your plugin mentioned you can just say
    Code:
    Log.Info("Myplugin: Starting Copy");
    and you will get
    Code:
    2011-09-21 19:54:18.501992 [Info.][(7)]: Myplugin: Starting Copy

    To do what you are trying I think you need to thread everything and it will pick up the thread name
     

    Walzing

    Portal Pro
    November 15, 2008
    187
    9
    AW: Read MP Config inside plugin

    To do what you are trying I think you need to thread everything and it will pick up the thread name
    Thx alot - just to come back with the solution:

    Code:
            void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
            {
                Thread thread = Thread.CurrentThread;
                thread.Name = "MPCopy";
                Log.Info("Timer elapsed");
                _backgroundWorker.RunWorkerAsync();
                _timer.Stop();
            }

    will write this to the log:
    2011-09-22 08:10:27.470004 [Info.][BassAudio(8)]: BASS: Initialize BASS environment ...
    2011-09-22 08:10:27.818024 [Info.][MPCopy(6)]: Timer elapsed
     

    Users who are viewing this thread

    Top Bottom