Logic, in its purest form, is the reasoning used to take a set of assumptions and reach a conclusion. More specifically, logic is the study of prescriptive systems of reasoning, that is, systems proposed as guides for how people (as well, perhaps, as other intelligent beings/machines/systems) ought to reason. Logic says which forms of inference are valid and which are not. Traditionally, logic is studied as a branch of philosophy, but it can also be considered a branch of mathematics and computer science. How people actually reason is usually studied under other headings, including cognitive psychology.
For more information, please see the main article about Logic.