This is ErrorReporting.m in view mode; [Download] [Up]
/* Copyright 1993 Jeremy Slade. All rights reserved. */ #import "ErrorReporting.h" #import <stdarg.h> #import <stdio.h> static unsigned debugLevel = 0; #define MAX_MSG 1024 @implementation Object ( ErrorReporting ) + debug:(unsigned)level :(const char *)fmt, ... /* Output a formatted debugging message if level is less than or equal to debugLevel */ { va_list params; char buf[MAX_MSG+1]; if ( level > debugLevel ) return ( self ); va_start ( params, fmt ); vsprintf ( buf, fmt, params ); va_end ( params ); printf ( buf ); return ( self ); } - debug:(unsigned)level :(const char *)fmt, ... /* Output a formatted debugging message if level is less than or equal to debugLevel */ { va_list params; char buf[MAX_MSG+1]; if ( level > debugLevel ) return ( self ); va_start ( params, fmt ); vsprintf ( buf, fmt, params ); va_end ( params ); printf ( buf ); return ( self ); } + setDebugLevel:(unsigned)level /* Set the debugging message output threshold */ { debugLevel = level; return ( self ); } - setDebugLevel:(unsigned)level /* Set the debugging message output threshold */ { debugLevel = level; return ( self ); } + (unsigned)debugLevel { return ( debugLevel ); } - (unsigned)debugLevel { return ( debugLevel ); } // ------------------------------------------------------------------------- // Error Messages // ------------------------------------------------------------------------- + errMsg:(const char *)fmt, ... /* Output a formatted error message */ { va_list params; char buf[MAX_MSG+1]; va_start ( params, fmt ); vsprintf ( buf, fmt, params ); va_end ( params ); printf ( buf ); return ( self ); } - errMsg:(const char *)fmt, ... /* Output a formatted error message */ { va_list params; char buf[MAX_MSG+1]; va_start ( params, fmt ); vsprintf ( buf, fmt, params ); va_end ( params ); printf ( buf ); return ( self ); } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.