Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nauman 98 posts 118 karma points
    Mar 02, 2010 @ 14:53
    Nauman
    0

    own logtype

    I have installed this package and woks great with umbraco log. How can I create my own "logtype" in this package. Like there are "LogType.Save", "LogType.Publish" or "LogType.Delete". How can I create my own like "LogType.Test"?

    Nauman

  • Dirk De Grave 4539 posts 6015 karma points MVP 3x admin c-trib
    Mar 02, 2010 @ 16:26
    Dirk De Grave
    0

    You can't using the existing code base as LogTypes is an enum you can't extend (at least not to my knowledge), but you can use the LogTypes.Custom to log specific items?

    If this is not satisfying, consider rolling your own log methods (which could be similar to the ones umbraco provides oob) as it's just a matter of inserting a record in the database (logtype is a string, so basically anything can be stored in that column)

    (not sure if logviewer will support those, selecting from db won't be the issue, i'm just not sure if log viewer is also using the enum type to get info from the db)

    Alternatively, go for an existing log strategy such as log4net or something similar.

     

    Cheers,

    /Dirk

  • Nauman 98 posts 118 karma points
    Mar 03, 2010 @ 06:43
    Nauman
    0

    Thanks Dirk

    Please can you guide me which umbraco table holds the logtype field?

    Nauman

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Mar 03, 2010 @ 08:54
    Thomas Höhler
    0

    There is no table holding the LogType they are defined by code.

  • Dirk De Grave 4539 posts 6015 karma points MVP 3x admin c-trib
    Mar 03, 2010 @ 09:26
    Dirk De Grave
    0

    All log entries are in the umbracoLog table if that's want you want to know, thomas is right about the the LogType enum which is declared in code.

    If you're using .net framework 3.5, you could use extension methods to extend the logger class' functionality. Darren has done a blog post on that.

     

    Cheers,

    /Dirk

Please Sign in or register to post replies

Write your reply to:

Draft