473,811 Members | 2,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

idea request: generic function logging

I need to create a log file that logs calls to a certain API. The
obvious way to do this is to put a bunch of output functions
before/after calls but it seems to me that there should be a generic
way to do this. Perhaps some way to override or use boost::function so
that you just wrap up your function in one of these function logging
objects and then invoke it...it does the rest. That is the kind of
thing I am looking for.

Anyone got any great ideas how to do this? The one I have involves
figuring out how function works and sort of recreating that
functionality I would need to make this work. I'm lazy enough to want
to find an easier way.

Nov 7 '06 #1
1 1344
This is a very good case for using aspects :) shame C++ doesn't support
them by default ... if you could use a variant (like AspectC++ - see:
http://en.wikipedia.org/wiki/AspectC++, main link is:
http://www.aspectc.org/) you could potentially log pre-call and
post-call of all the functions you need.

As simple as creating an aspect using:

advice pointcut : before(...) {...}
the advice code is executed before the join points in the pointcut
advice pointcut : after(...) {...}
the advice code is executed after the join points in the pointcut

Nov 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2436
by: R | last post by:
Hello everybody. I'm writing my own Content System in PHP5. I've written so far main classes for handling DB connections, XML, XForms and Sessions. But I've got problem with one thing - it's not even relative with implementation - I'm looking for a smart solution My present system works like this:
0
1283
by: Simon Elliott | last post by:
I have a class which uses a singleton to output progress messages for logging or display. It's typically used deep within a hierarchy of aggregations, inheritances and containers. The singleton keeps things nice and simple: the classes further up the hierarchy don't need to know about the mechanism used for handling progress messages. I now want this class to be more generic, and perhaps put it into a library. The users of the class may...
6
2294
by: Agoston Bejo | last post by:
Hi. x1.asp: <form method="post" action="x2.asp"> .... </form> x2.asp: DoSomeAdministration() Response.Redirect "x3.asp?" & Request.Form x3.asp: further processsing of data
6
3979
by: Robin | last post by:
Are there any generic classes available that can be used in VB.Net to perform common tasks such as Database Access and Logging?
1
1242
by: Raphael Bauduin | last post by:
Hi, I'm looking at the logging aof a database we'll put in production soon. I've seen some posts on this list about history tables, like mentioned in http://www-106.ibm.com/developerworks/web/library/wa-dbdsgn2.html . I think I'll go that way too, but I still have some questions on the approach: - is it possible to write only one function used for all logging triggers? As illustrated in http://www.varlena.com/varlena/GeneralBits/57.php...
7
19087
by: itay_k | last post by:
Hi, I dont understand why this is so complicated, just to add one line of cookie header on the GET request. This is my unworking code: import time import Cookie import cookielib, urllib2
7
24873
by: vvkl | last post by:
I have readed a example code from MSDN about FormsAuthenticationTicket calss, but there's a line I can't understand : 'strRedirect = Request;' What's the mean in which square brackets? Thank you! A Chinese student.
3
2082
by: shapper | last post by:
Hello, I am created an Asp.Net 2.0 repeater implementing the ITemplate class. I know my datasource, a datatable has 6 rows, but the repeater only displays the last one. If I add more rows to my datatable I keep seeing only the last record on my repeater. any idea why?
5
6139
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request scope. Application variables are then accessed in this manner Request.App.<Var>. To begin with I had a simple functioning login system inside a subdirectory named admin, this subdirectory had it's own application.cfm, I wasn't sure whether to duplicate...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10135
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.