Pipe serial dump to SD card file
Have the MFRC522 objects remember where you want them to send the output
by adding a data member to the class like this:



private:
    Print &amp;output;


This is a reference to a Print object, i.e. any object where you can
print() or println() to. This reference should be initialized in the
constructor, like this

MFRC522:MFRC522(...other arguments..., Print &amp;my_output = Serial)
: ...other initializations..., output(my_output)
{
    ...constructor body...
}


Notice that, by default, the output is initialiazed as a reference to
Serial. Thus, unless you explicitly ask for the output to go
elsewhere, the class will behave as before.

Last step is to change, in the implementation of the class, every
reference to Serial by output. This is just a global find and
replace.

At this point, the MFRC522 class can be used exactly as before, and it
will behave identically. This means that every user of the library
should be able to use your modified version with no issues. I thus
encourage you to submit the changes to the original author, so that they
have a chance to be incorporated into the canonical version of the
library.

Now, if you want this debugging output to be sent elsewhere, just
provide the destination as the last argument of the constructor:

MFRC522 my_RFID_module(...other arguments..., my_SD_card_file);


As long as the destination is an instance of the Print virtual class
(basically anything you can print() to should be OK), it should work
as expected.