Skip to content

Instantly share code, notes, and snippets.

@prisonerjohn
Last active September 30, 2019 21:46
Show Gist options
  • Save prisonerjohn/508a5931b143bdd79d67981ac4d29260 to your computer and use it in GitHub Desktop.
Save prisonerjohn/508a5931b143bdd79d67981ac4d29260 to your computer and use it in GitHub Desktop.
Logging
#include "ofApp.h"
void ofApp::setup()
{
//ofSetLogLevel(OF_LOG_VERBOSE);
//ofSetLogLevel(OF_LOG_NOTICE); // default
ofSetLogLevel(OF_LOG_WARNING);
//ofSetLogLevel(OF_LOG_ERROR);
//ofSetLogLevel(OF_LOG_FATAL_ERROR);
//ofSetLogLevel(OF_LOG_SILENT);
ofLogToFile("log-" + ofGetTimestampString() + ".txt", true);
ofLogVerbose(__FUNCTION__) << "The app is now starting!";
if (image.load("puppies.png"))
{
float imageRatio = image.getWidth() / image.getHeight();
if (imageRatio != 16 / 9)
{
ofLogWarning(__FUNCTION__) << "Puppies image has the wrong aspect ratio " << imageRatio << ", it will be stretched!";
}
else
{
ofLogNotice(__FUNCTION__) << "Puppies image loaded successfully with dimensions " << image.getWidth() << "x" << image.getHeight() << ".";
}
}
else
{
ofLogError(__FUNCTION__) << "Unable to load puppies image, make sure it's in the data folder!";
}
if (grabber.setup(640, 480))
{
ofLogFatalError(__FUNCTION__) << "Unable to open camera, there's no reason to keep going :(";
}
}
#include "ofApp.h"
void ofApp::setup()
{
ofLog(OF_LOG_VERBOSE) << "The app is now starting!";
if (image.load("puppies.png"))
{
float imageRatio = image.getWidth() / image.getHeight();
if (imageRatio != 16 / 9)
{
ofLog(OF_LOG_WARNING) << "Puppies image has the wrong aspect ratio " << imageRatio <<", it will be stretched!";
}
else
{
ofLog(OF_LOG_NOTICE) << "Puppies image loaded successfully with dimensions " << image.getWidth() << "x" << image.getHeight() << ".";
}
}
else
{
ofLog(OF_LOG_ERROR) << "Unable to load puppies image, make sure it's in the data folder!";
}
if (grabber.setup(640, 480))
{
ofLog(OF_LOG_FATAL_ERROR) << "Unable to open camera, there's no reason to keep going :(";
}
}
#include "ofApp.h"
void ofApp::setup()
{
//ofSetLogLevel(OF_LOG_VERBOSE);
//ofSetLogLevel(OF_LOG_NOTICE); // default
ofSetLogLevel(OF_LOG_WARNING);
//ofSetLogLevel(OF_LOG_ERROR);
//ofSetLogLevel(OF_LOG_FATAL_ERROR);
//ofSetLogLevel(OF_LOG_SILENT);
ofLogVerbose(__FUNCTION__) << "The app is now starting!";
if (image.load("puppies.png"))
{
float imageRatio = image.getWidth() / image.getHeight();
if (imageRatio != 16 / 9)
{
ofLogWarning(__FUNCTION__) << "Puppies image has the wrong aspect ratio " << imageRatio <<", it will be stretched!";
}
else
{
ofLogNotice(__FUNCTION__) << "Puppies image loaded successfully with dimensions " << image.getWidth() << "x" << image.getHeight() << ".";
}
}
else
{
ofLogError(__FUNCTION__) << "Unable to load puppies image, make sure it's in the data folder!";
}
if (grabber.setup(640, 480))
{
ofLogFatalError(__FUNCTION__) << "Unable to open camera, there's no reason to keep going :(";
}
}
#include "ofApp.h"
void ofApp::setup()
{
//ofSetLogLevel(OF_LOG_VERBOSE);
//ofSetLogLevel(OF_LOG_NOTICE); // default
ofSetLogLevel(OF_LOG_WARNING);
//ofSetLogLevel(OF_LOG_ERROR);
//ofSetLogLevel(OF_LOG_FATAL_ERROR);
//ofSetLogLevel(OF_LOG_SILENT);
ofLogVerbose("App") << "The app is now starting!";
if (image.load("puppies.png"))
{
float imageRatio = image.getWidth() / image.getHeight();
if (imageRatio != 16 / 9)
{
ofLogWarning("Image Load") << "Puppies image has the wrong aspect ratio " << imageRatio <<", it will be stretched!";
}
else
{
ofLogNotice("Image Load") << "Puppies image loaded successfully with dimensions " << image.getWidth() << "x" << image.getHeight() << ".";
}
}
else
{
ofLogError("Image Load") << "Unable to load puppies image, make sure it's in the data folder!";
}
if (grabber.setup(640, 480))
{
ofLogFatalError("Grabber Setup") << "Unable to open camera, there's no reason to keep going :(";
}
}
#include "ofApp.h"
void ofApp::setup()
{
//ofSetLogLevel(OF_LOG_VERBOSE);
//ofSetLogLevel(OF_LOG_NOTICE); // default
ofSetLogLevel(OF_LOG_WARNING);
//ofSetLogLevel(OF_LOG_ERROR);
//ofSetLogLevel(OF_LOG_FATAL_ERROR);
//ofSetLogLevel(OF_LOG_SILENT);
ofLogVerbose() << "The app is now starting!";
if (image.load("puppies.png"))
{
float imageRatio = image.getWidth() / image.getHeight();
if (imageRatio != 16 / 9)
{
ofLogWarning() << "Puppies image has the wrong aspect ratio " << imageRatio <<", it will be stretched!";
}
else
{
ofLogNotice() << "Puppies image loaded successfully with dimensions " << image.getWidth() << "x" << image.getHeight() << ".";
}
}
else
{
ofLogError() << "Unable to load puppies image, make sure it's in the data folder!";
}
if (grabber.setup(640, 480))
{
ofLogFatalError() << "Unable to open camera, there's no reason to keep going :(";
}
}
#include "ofApp.h"
void ofApp::setup()
{
//ofSetLogLevel(OF_LOG_VERBOSE);
//ofSetLogLevel(OF_LOG_NOTICE); // default
ofSetLogLevel(OF_LOG_WARNING);
//ofSetLogLevel(OF_LOG_ERROR);
//ofSetLogLevel(OF_LOG_FATAL_ERROR);
//ofSetLogLevel(OF_LOG_SILENT);
ofLog(OF_LOG_VERBOSE) << "The app is now starting!";
if (image.load("puppies.png"))
{
float imageRatio = image.getWidth() / image.getHeight();
if (imageRatio != 16 / 9)
{
ofLog(OF_LOG_WARNING) << "Puppies image has the wrong aspect ratio " << imageRatio <<", it will be stretched!";
}
else
{
ofLog(OF_LOG_NOTICE) << "Puppies image loaded successfully with dimensions " << image.getWidth() << "x" << image.getHeight() << ".";
}
}
else
{
ofLog(OF_LOG_ERROR) << "Unable to load puppies image, make sure it's in the data folder!";
}
if (grabber.setup(640, 480))
{
ofLog(OF_LOG_FATAL_ERROR) << "Unable to open camera, there's no reason to keep going :(";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment