Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 309295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:43:44+00:00 2026-05-12T07:43:44+00:00

I am implementing a tracing mechanism myself. Now what I’d like to know is

  • 0

I am implementing a tracing mechanism myself. Now what I’d like to know is what is the best way to implement this mechanism(I mean, the architecture). First I thought of creating a class like this:

class Tracer {
    public void NewEventRegistered(etc) {...} //this is the method I use to send this class the events I want to register

    event newEventRegistered(..) //this is the event the user is going to use to catch all the events in the application that have been sent to NewEventRegistered method.
}

But then I saw there is an TraceListener class that let’s me implement Write and WriteLine methods. The big drawback is that both those methods allow only strings as arguments, and I’d want to be able to send a lot more info than strings. What should I do? Maybe my first ideia is the best?

edit: I do know there are a lot of tracing mechanisms like PostSharp and so, I’m just doing this for learning purposes!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:43:44+00:00Added an answer on May 12, 2026 at 7:43 am

    The Write and WriteLine functions that accept strings only represent the minimum pair of functions you have to override. There are other write functions in TraceListener you can optionally override that accept objects.

    TraceListener is, however, designed for use with the framework tracing functions. So if you’re not going to use the class to “listen” to trace output going through the framework, you may be better off with an interface more suited to your particular tracing needs.

    Perhaps inheriting from System.IO.TextWriter would be better for your case. It has many write methods, but I believe they route all their output through Write and WriteLine, so if you just override those two functions, you get a lot for free.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing the application just like tracking the user's traveling. Now I'm using the
implementing publishActivity in PHP using the REST API using this code: $activity = array(
Implementing the very first scala example I ran into some problems probably tipical for
I'm implementing the component labelling algorithm as in this paper using python and opencv.
So I gave up implementing my own memoryleak tracking (in this question overloading new
Im working on implementing this Social Medial Plugin called Sharre: http://sharrre.com For example 5:
I'm implementing various PHP & ASP.NET web apps for a client. I'd like to
First of all I have a simple ListView . Implementing the BaseAdapter and utilizing
Is there a way to use Microsoft Sync Framework without implementing the required schema
Implementing a custom Dependency Property on a Framework Element object causes my Visual Studio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.