Occasional Vlog
How To Use Google Logging Library (glog) (as of ) Introduction. Google glog is a library that implements application-level logging. This library provides logging APIs based on C-style streams and various helper macros. But we do a good zoo trip. Check #markandgem out on Twitter: Facebook: Ins. Vlog is a video blog that is published on the internet on any social or interactive platform. The term “video blog” is a combination of video and blog, which many people know that these are two different things. Hello, I am Paul. My wife Elizabeth and I welcome you to our occasional vlog. Along with our four children we make up the Riley family although it seems the two teenagers are camera shy. A good vlog is all about content and the clarity of the video and audio, and this is independent of the editor you use. So, if you can use cheaper or free editors and get better results, there is no need to go for expensive options.
(as of)Introduction
Google glog is a library that implements application-levellogging. This library provides logging APIs based on C++-stylestreams and various helper macros.You can log a message by simply streaming things to LOG(<aparticular severity level>), e.g.
Google glog defines a series of macros that simplify many common loggingtasks. You can log messages by severity level, control loggingbehavior from the command line, log based on conditionals, abort theprogram when expected conditions are not met, introduce your ownverbose logging levels, and more. This document describes thefunctionality supported by glog. Please note that this documentdoesn't describe all features in this library, but the most usefulones. If you want to find less common features, please checkheader files under src/glog
directory.
Severity Level
You can specify one of the following severity levels (inincreasing order of severity): INFO
, WARNING
,ERROR
, and FATAL
.Logging a FATAL
message terminates the program (after themessage is logged).Note that messages of a given severity are logged not only in thelogfile for that severity, but also in all logfiles of lower severity.E.g., a message of severity FATAL
will be logged to thelogfiles of severity FATAL
, ERROR
,WARNING
, and INFO
.
The DFATAL
severity logs a FATAL
error indebug mode (i.e., there is no NDEBUG
macro defined), butavoids halting the program in production by automatically reducing theseverity to ERROR
.
Unless otherwise specified, glog writes to the filename'/tmp/<program name>.<hostname>.<user name>.log.<severity level>.<date>.<time>.<pid>'(e.g., '/tmp/hello_world.example.com.hamaji.log.INFO.20080709-222411.10474').By default, glog copies the log messages of severity levelERROR
or FATAL
to standard error (stderr)in addition to log files.
Setting Flags
Several flags influence glog's output behavior.If the Googlegflags library is installed on your machine, theconfigure
script (see the INSTALL file in the package fordetail of this script) will automatically detect and use it,allowing you to pass flags on the command line. For example, if youwant to turn the flag --logtostderr
on, you can startyour application with the following command line:If the Google gflags library isn't installed, you set flags viaenvironment variables, prefixing the flag name with 'GLOG_', e.g.
The following flags are most commonly used:
Occasional Vlog 2
logtostderr
(bool
, default=false
)- Log messages to stderr instead of logfiles.
Note: you can set binary flags totrue
by specifying1
,true
, oryes
(caseinsensitive).Also, you can set binary flags tofalse
by specifying0
,false
, orno
(again, caseinsensitive). stderrthreshold
(int
, default=2, whichisERROR
)- Copy log messages at or above this level to stderr inaddition to logfiles. The numbers of severity levels
INFO
,WARNING
,ERROR
, andFATAL
are 0, 1, 2, and 3, respectively. minloglevel
(int
, default=0, whichisINFO
)- Log messages at or above this level. Again, the numbers ofseverity levels
INFO
,WARNING
,ERROR
, andFATAL
are 0, 1, 2, and 3,respectively. log_dir
(string
, default=')- If specified, logfiles are written into this directory insteadof the default logging directory.
v
(int
, default=0)- Show all
VLOG(m)
messages form
less orequal the value of this flag. Overridable by --vmodule.See the section about verbose logging for moredetail. vmodule
(string
, default=')- Per-module verbose level. The argument has to contain acomma-separated list of <module name>=<log level>.<module name>is a glob pattern (e.g.,
gfs*
for all modules whose namestarts with 'gfs'), matched against the filename base(that is, name ignoring .cc/.h./-inl.h).<log level> overrides any value given by --v.See also the section about verbose logging.
There are some other flags defined in logging.cc. Please grep thesource code for 'DEFINE_' to see a complete list of all flags.
You can also modify flag values in your program by modifying globalvariables FLAGS_*
. Most settings start workingimmediately after you update FLAGS_*
. The exceptions arethe flags related to destination files. For example, you might want toset FLAGS_log_dir
beforecalling google::InitGoogleLogging
. Here is an example:
Conditional / Occasional Logging
Sometimes, you may only want to log a message under certainconditions. You can use the following macros to perform conditionallogging:The 'Got lots of cookies' message is logged only when the variablenum_cookies
exceeds 10.If a line of code is executed many times, it may be useful to only loga message at certain intervals. This kind of logging is most usefulfor informational messages.
The above line outputs a log messages on the 1st, 11th,21st, ... times it is executed. Note that the specialgoogle::COUNTER
value is used to identify which repetition ishappening.
You can combine conditional and occasional logging with thefollowing macro.
Instead of outputting a message every nth time, you can also limitthe output to the first n occurrences:
Outputs log messages for the first 20 times it is executed. Again,the google::COUNTER
identifier indicates which repetition ishappening.
Debug Mode Support
Special 'debug mode' logging macros only have an effect in debugmode and are compiled away to nothing for non-debug modecompiles. Use these macros to avoid slowing down your productionapplication due to excessive logging.
CHECK Macros
It is a good practice to check expected conditions in your programfrequently to detect errors as early as possible. TheCHECK
macro provides the ability to abort the applicationwhen a condition is not met, similar to the assert
macrodefined in the standard C library.
CHECK
aborts the application if a condition is nottrue. Unlike assert
, it is *not* controlled byNDEBUG
, so the check will be executed regardless ofcompilation mode. Therefore, fp->Write(x)
in thefollowing example is always executed:
There are various helper macros forequality/inequality checks - CHECK_EQ
,CHECK_NE
, CHECK_LE
, CHECK_LT
,CHECK_GE
, and CHECK_GT
.They compare two values, and log aFATAL
message including the two values when the result isnot as expected. The values must have operator<<(ostream,...)
defined.
You may append to the error message like so:
We are very careful to ensure that each argument is evaluated exactlyonce, and that anything which is legal to pass as a function argument islegal here. In particular, the arguments may be temporary expressionswhich will end up being destroyed at the end of the apparent statement,for example:
The compiler reports an error if one of the arguments is apointer and the other is NULL. To work around this, simply static_castNULL to the type of the desired pointer.
Better yet, use the CHECK_NOTNULL macro:
Since this macro returns the given pointer, this is very useful inconstructor initializer lists.
Note that you cannot use this macro as a C++ stream due to thisfeature. Please use CHECK_EQ
described above to log acustom message before aborting the application.
If you are comparing C strings (char *), a handy set of macrosperforms case sensitive as well as case insensitive comparisons -CHECK_STREQ
, CHECK_STRNE
,CHECK_STRCASEEQ
, and CHECK_STRCASENE
. TheCASE versions are case-insensitive. You can safely pass NULL
pointers for this macro. They treat NULL
and anynon-NULL
string as not equal. Two NULL
s areequal.
Note that both arguments may be temporary strings which aredestructed at the end of the current 'full expression'(e.g., CHECK_STREQ(Foo().c_str(), Bar().c_str())
whereFoo
and Bar
return C++'sstd::string
).
The CHECK_DOUBLE_EQ
macro checks the equality of twofloating point values, accepting a small error margin.CHECK_NEAR
accepts a third floating point argument, whichspecifies the acceptable error margin.
Verbose Logging
When you are chasing difficult bugs, thorough log messages are veryuseful. However, you may want to ignore too verbose messages in usualdevelopment. For such verbose logging, glog provides theVLOG
macro, which allows you to define your own numericlogging levels. The --v
command line option controlswhich verbose messages are logged:
With VLOG
, the lower the verbose level, the morelikely messages are to be logged. For example, if--v1
, VLOG(1)
will log, butVLOG(2)
will not log. This is opposite of the severitylevel, where INFO
is 0, and ERROR
is 2.--minloglevel
of 1 will log WARNING
andabove. Though you can specify any integers for both VLOG
macro and --v
flag, the common values for them are smallpositive integers. For example, if you write VLOG(0)
,you should specify --v=-1
or lower to silence it. Thisis less useful since we may not want verbose logs by default in mostcases. The VLOG
macros always log at theINFO
log level (when they log at all).
Verbose logging can be controlled from the command line on aper-module basis:
will:
- a. Print VLOG(2) and lower messages from mapreduce.{h,cc}
- b. Print VLOG(1) and lower messages from file.{h,cc}
- c. Print VLOG(3) and lower messages from files prefixed with 'gfs'
- d. Print VLOG(0) and lower messages from elsewhere
The wildcarding functionality shown by (c) supports both '*'(matches 0 or more characters) and '?' (matches any single character)wildcards. Please also check the section about command line flags.
There's also VLOG_IS_ON(n)
'verbose level' conditionmacro. This macro returns true when the --v
is equal orgreater than n
. To be used as
Verbose level condition macros VLOG_IF
,VLOG_EVERY_N
and VLOG_IF_EVERY_N
behaveanalogous to LOG_IF
, LOG_EVERY_N
,LOF_IF_EVERY
, but accept a numeric verbosity level asopposed to a severity level.
Failure Signal Handler
The library provides a convenient signal handler that will dump usefulinformation when the program crashes on certain signals such as SIGSEGV.The signal handler can be installed bygoogle::InstallFailureSignalHandler(). The following is an example of outputfrom the signal handler.
By default, the signal handler writes the failure dump to the standarderror. You can customize the destination by InstallFailureWriter().
Miscellaneous Notes
Performance of Messages
The conditional logging macros provided by glog (e.g.,CHECK
, LOG_IF
, VLOG
, ...) arecarefully implemented and don't execute the right hand sideexpressions when the conditions are false. So, the following checkmay not sacrifice the performance of your application.
User-defined Failure Function
FATAL
severity level messages or unsatisfiedCHECK
condition terminate your program. You can changethe behavior of the termination byInstallFailureFunction
.
By default, glog tries to dump stacktrace and makes the programexit with status 1. The stacktrace is produced only when you run theprogram on an architecture for which glog supports stack tracing (asof September 2008, glog supports stack tracing for x86 and x86_64).
Raw Logging
The header file <glog/raw_logging.h>
can beused for thread-safe logging, which does not allocate any memory oracquire any locks. Therefore, the macros defined in thisheader file can be used by low-level memory allocation andsynchronization code.Please check src/glog/raw_logging.h.in
for detail.
Google Style perror()
PLOG()
and PLOG_IF()
andPCHECK()
behave exactly like their LOG*
andCHECK
equivalents with the addition that they append adescription of the current state of errno to their output lines.E.g.
This check fails with the following error message.
Syslog
SYSLOG
, SYSLOG_IF
, andSYSLOG_EVERY_N
macros are available.These log to syslog in addition to the normal logs. Be aware thatlogging to syslog can drastically impact performance, especially ifsyslog is configured for remote logging! Make sure you understand theimplications of outputting to syslog before you use these macros. Ingeneral, it's wise to use these macros sparingly.
Strip Logging Messages
Strings used in log messages can increase the size of your binaryand present a privacy concern. You can therefore instruct glog toremove all strings which fall below a certain severity level by usingthe GOOGLE_STRIP_LOG macro:
If your application has code like this:
The compiler will remove the log messages whose severities are lessthan the specified integer value. SinceVLOG
logs at the severity level INFO
(numeric value 0
),setting GOOGLE_STRIP_LOG
to 1 or greater removesall log messages associated with VLOG
s as well asINFO
log statements.
Notes for Windows users
Google glog defines a severity level ERROR
, which isalso defined in windows.h
. You can make glog not defineINFO
, WARNING
, ERROR
,and FATAL
by definingGLOG_NO_ABBREVIATED_SEVERITIES
beforeincluding glog/logging.h
. Even with this macro, you canstill use the iostream like logging facilities:
However, you cannotuse INFO
, WARNING
, ERROR
,and FATAL
anymore for functions definedin glog/logging.h
.
If you don't need ERROR
definedby windows.h
, there are a couple of more workaroundswhich sometimes don't work:
- #define
WIN32_LEAN_AND_MEAN
orNOGDI
before you #includewindows.h
. - #undef
ERROR
after you #includewindows.h
.
See this issue for more detail.
Shinichiro HamajiGregor Hohpe
Then subscribe to add us, we will not spam you.
Occasional Vlog Table
Are you going on a holiday soon, and want to make a video that will help you remember it? Read on for some helpful travel vlogging tips that will help you make travel videos you'll want to watch over and over again.
1) Don't film everything
Yes, really. The first travel vlogging tip is you shouldn't film everything you experience on your trip. I understand that sometimes you don't want to miss a single moment. I've been there and done that. When I returned from one of my trips, I had over a hundred clips I didn't really want to use in the end - clips of some food I ate, a video tour of my accommodation, my plane ride and more.
I'm not saying that those clips are bad. They're nice clips and they capture the moment, but I personally felt that they're not interesting memories that I want to make a vlog of. Also, I spent so time glued to my camera trying to film everything, that I didn't really live in the moment.
So set aside some time to be clear on what sort of video(s) you want to make. This way, you'll save a lot of time, camera battery, and you'll have a better experience travelling overall.
2) Centre your vlogs around an activity or place
There's many different directions your video can take. Many people do it chronologically (usually day to day vlogs). However, I've found that videos that are centred around a place or activity are a lot more interesting than a video that covers whole day.
If you find a place you really enjoyed spending your time in, you should make a video of that. If you found yourself loving a lot of the food a country has to offer, why not make a food review vlog? Or if you're travelling to shop, you could do a haul video of everything you bought.
3) Keep your videos short and succinct
The best timing for videos is under three minutes, as many people start to lose interest if the video is longer than that. Also, talking segments should not be longer than 30 seconds. I know 30 seconds doesn't seem like much, but people are impatient on social media and are quick to move on if a video doesn't hold their interest.
It also helps to keep in mind that your end goal is to make a video that is a couple of minutes long. When you remember that, you will naturally take shorter videos that capture the essence of what you're trying to show.
At the end of the trip, you should have a lot of 3-7 second long clips that you compile to make the finished product. It may seem like you have bits and pieces, but you will thank yourself as shorter clips will save you so much time during editing.
4) Don't be afraid to show more of yourself
To be honest with you, I still feel camera shy plenty of times. I know how difficult it can be to get in front of a camera, especially when there's a lot of other people around.
But remember that you're the backbone of your vlog. You should definitely talk to the camera and give your own perspective on your trip.
Something that helps me speak better to the camera is to pretend I'm talking to a really good friend. That always keeps me smiling, and makes me more natural in front of the camera.
5) Include other people in your vlog
Vlogs always get more interesting when there's other people included. You can include your travel buddies, or some of the local people you've met on your trip.
Pro-tip: Ask them a question.
What most people do is point a camera at their friends, who then wave back and pose at the camera. Try engaging your friends instead, and ask them what they think about the place they're in, or what they liked most about the trip so far. That definitely adds more flavour and personality to your video.
6) Show things from your point of view
The main difference between a travel vlog and a normal travel video is that a travel vlog focuses a lot on you and your personality. You can make your vlog even better by adding some video clips taken from your point of view.
It is a great way to engage your audience and make them feel like they are there with you.
7) Start your video with an establishing shot
An establishing shot is a video clip that shows the big picture of the place you're in. Often times, people spend so much time taking videos of the things they do and the people they're with, that they forget to take videos which establish where they are.
For example, if you're in Tokyo, a good establishing shot would be a view of the city skyline. Adding such a clip to the beginning of your vlog makes it look a lot more professional and sleek.
8) Keep your video steady, not shaky
Occasional Vlog Background
Shaky video is something that stops people from watching your video longer. The occasional shake when walking down a path is fine, but a video that that constantly jerky is bound to put people off.
You can reduce shakiness by walking slower and making a conscious effort to keep your camera steady. Alternatively, you could use video stabilisation tools found in video editing software or apps, such as Adobe Premiere Pro or Emulsio. I find that reducing the speed of the video where possible also helps reduce the shakiness a lot.
Pro-tip: If you can, invest money into equipment that will help you stabilise your video.
If you don't mind spending some money, you can buy a handheld stabiliser for your phone or compact camera. Alternatively, you could purchase a camera with in-built image stabilisation.
9) Avoid filming with a lot of wind or noise in the background
Where possible, try to vlog at places that are not too noisy. I've filmed at a windy beach before, and it was so difficult to salvage that clip. I had to trim away most of it, and the part that remained was extremely unpleasant to listen to.
A good idea would be to film a test clip, and immediately play it back to check the sound. If the clip sounds noisy, try talking louder. If that still doesn't work, you should try to find a more conducive place to film.
Pro-tip: Use a wind muff
People who don't mind spending money to improve sound quality could purchase a wind muff for their camera. It is like a little tuft of fur you stick on your camera's microphone. It doesn't reduce sound quality, and it virtually removes the annoying sound that is produced with a strong breeze.
10) Choose good music that accentuates the mood of your video
It's pretty important to have music that fits your video, as the music really has an impact on your viewers. Try to choose music that accentuates the vibes you want to bring across.
For example, you'd definitely want to use rock or pop music to get adrenaline rushing when people watch your bungee jumping vlog. Or you might want to use chill tropical beats to make a cool video of your time at the beach.
The YouTube audio library is a great place to get free music. SoundCloud has a better variety of music, but not all songs can be downloaded for free.
11) Put your vlog aside for a while then re-evaluate
Once you're done editing your travel vlog, set it aside for a day or two before you look at it again. I usually do this, and I always find things to improve the second time I watch it. By doing this, you refresh your mind, and it seems like you're watching with a new perspective when it is time to re-evalutate. This is a great technique that you should definitely use.
12) Watch other travel vlogs
Finally, the most important travel vloggin tip: Watch other travel vlogs.
There's a whole lot of vlogs out there on YouTube and they are great learning material for improving your own skills. I learned most of the tips I'm sharing on this list from all of the travel vlogs I've watched in the past.
If you have time to spare, I recommend that you watch popular travel vloggers such as Hey Nadine, Mr Ben Brown, or Fun For Louis.
When you watch them, you will be able to see how the different tips I've talked about come into play in their videos, and you will gain ideas and inspiration for your next vlog.
I'm going to leave you with one of the first few vlogs I did. It is a vlog of my most favourite place in Vietnam, and it is where I snapped all these pictures at. Enjoy!
With that, I have reached the end of my list of travel vlogging tips. I hope this list helped you see that good travel vlogs can be done even with just a cell phone. All you need is to put in some effort and follow the tips I gave you.
Sara is a final year student at Nanyang Technological University. Not only does she enjoy vlogging when she travels, she also likes to write articles and guides which she posts on her blog - Lights, Camera, Adventure!
Make your memories last with these 12 Best Travel vlogging tips! Share your travel experience in the comment box below! Sign up at Flying Chalks to receive more travel tips from us!