Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » Applications » Downloads
 
Add your own
alternative version

C# WPF Log4Net Viewer

, 15 Oct 2009
Log4Net XML log viewer
LogViewer.zip
LogViewer
bin
Debug
LogViewer.exe
LogViewer.vshost.exe
LogViewer.vshost.exe.manifest
LogViewer.csproj.user
LogViewer.suo
Properties
Settings.settings
Resources
Images
arrow_left.png
arrow_right.png
find.png
Skins
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
using System.Drawing;
using System.Windows.Interop;
using System.Windows;

namespace LogViewer
{
    public class LogEntry
    {
        public enum IMAGE_TYPE
        {
            DEBUG = 0,
            ERROR = 1,
            FATAL = 2,
            INFO = 3,
            WARN = 4,
            CUSTOM = 5
        }

        private static Dictionary<IMAGE_TYPE, BitmapSource> _ImageList =
            new Dictionary<IMAGE_TYPE, BitmapSource>()
            {
                {IMAGE_TYPE.DEBUG, Imaging.CreateBitmapSourceFromHIcon(SystemIcons.Question.Handle, Int32Rect.Empty, null)},
                {IMAGE_TYPE.ERROR, Imaging.CreateBitmapSourceFromHIcon(SystemIcons.Error.Handle, Int32Rect.Empty, null)},
                {IMAGE_TYPE.FATAL, Imaging.CreateBitmapSourceFromHIcon(SystemIcons.Hand.Handle, Int32Rect.Empty, null)},
                {IMAGE_TYPE.INFO, Imaging.CreateBitmapSourceFromHIcon(SystemIcons.Information.Handle, Int32Rect.Empty, null)},
                {IMAGE_TYPE.WARN, Imaging.CreateBitmapSourceFromHIcon(SystemIcons.Warning.Handle, Int32Rect.Empty, null)},
                {IMAGE_TYPE.CUSTOM, Imaging.CreateBitmapSourceFromHIcon(SystemIcons.Asterisk.Handle, Int32Rect.Empty, null)}
            };

        public static BitmapSource Images(IMAGE_TYPE type)
        {
            return _ImageList[type];
        }

        private int _Item = 0;
        public int Item
        {
            get { return _Item; }
            set { _Item = value; }
        }

        private DateTime _TimeStamp = new DateTime(1970, 1, 1, 0, 0, 0, 0);
        public DateTime TimeStamp
        {
            get { return _TimeStamp; }
            set { _TimeStamp = value; }
        }

        private BitmapSource _Image = _ImageList[IMAGE_TYPE.CUSTOM];
        public BitmapSource Image
        {
            get { return _Image; }
            set { _Image = value; }
        }

        private string _Level = string.Empty;
        public string Level
        {
            get { return _Level; }
            set { _Level = value; }
        }

        private string _Thread = string.Empty;
        public string Thread
        {
            get { return _Thread; }
            set { _Thread = value; }
        }

        private string _Message = string.Empty;
        public string Message
        {
            get { return _Message; }
            set { _Message = value; }
        }

        private string _MachineName = string.Empty;
        public string MachineName
        {
            get { return _MachineName; }
            set { _MachineName = value;}
        }

        private string _UserName = string.Empty;
        public string UserName
        {
            get { return _UserName; }
            set { _UserName = value; }
        }

        private string _HostName = string.Empty;
        public string HostName
        {
            get { return _HostName; }
            set { _HostName = value; }
        }

        private string _App = string.Empty;
        public string App
        {
            get { return _App; }
            set { _App = value; }
        }

        private string _Throwable = string.Empty;
        public string Throwable
        {
            get { return _Throwable; }
            set { _Throwable = value; }
        }

        private string _Class = string.Empty;
        public string Class
        {
            get { return _Class; }
            set { _Class = value; }
        }

        private string _Method = string.Empty;
        public string Method
        {
            get { return _Method; }
            set { _Method = value; }
        }

        private string _File = string.Empty;
        public string File
        {
            get { return _File; }
            set { _File = value; }
        }

        private string _Line = string.Empty;
        public string Line
        {
            get { return _Line; }
            set { _Line = value; }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Ken C. Len
Software Developer (Senior) LEN Associates Inc.
United States United States
Years of software consulting and software development using Microsoft development products such as Microsoft Content Management System, SQL Server Reporting Service, ASP.Net C# VB.Net, HTML and javascript web development, Visual Studio add-on development, C++ MFC/ATL and COM+ development, and ActiveX components.

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 15 Oct 2009
Article Copyright 2008 by Ken C. Len
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid